Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(migrations): Fix tags migrations #3419

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ def mark_existing_tags_as_permanent(
tag_class.objects.bulk_update(to_update, fields=["is_permanent"])


def populate_default_tag_type(
apps: Apps, schema_editor: BaseDatabaseSchemaEditor
) -> None:
apps.get_model("tags", "tag").objects.filter(type__isnull=True).update(
type=TagType.NONE.value
)


class Migration(migrations.Migration):
dependencies = [
("tags", "0004_add_uuid_field"),
Expand Down Expand Up @@ -75,22 +67,9 @@ class Migration(migrations.Migration):
name="type",
field=models.CharField(
choices=[("NONE", "None"), ("STALE", "Stale")],
null=True,
help_text="Field used to provide a consistent identifier for the FE and API to use for business logic.",
max_length=100,
),
),
migrations.RunPython(
populate_default_tag_type, reverse_code=migrations.RunPython.noop
),
migrations.AlterField(
model_name="tag",
name="type",
field=models.CharField(
choices=[("NONE", "None"), ("STALE", "Stale")],
default="NONE",
help_text="Field used to provide a consistent identifier for the FE and API to use for business logic.",
max_length=100,
),
),
]
Loading