Skip to content

Commit

Permalink
fix empty database migrations (#1136)
Browse files Browse the repository at this point in the history
  • Loading branch information
shapiromatron authored Dec 4, 2024
1 parent c1c58ff commit bdd47bb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
2 changes: 2 additions & 0 deletions hawc/apps/eco/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Migration(migrations.Migration):
"type",
models.CharField(choices=[("CE", "cause/effect")], default="CE", max_length=2),
),
("deprecated_on", models.DateTimeField(blank=True, default=None, null=True)),
("created", models.DateTimeField(auto_now_add=True)),
("last_updated", models.DateTimeField(auto_now=True)),
("notes", models.TextField(blank=True)),
Expand Down Expand Up @@ -92,6 +93,7 @@ class Migration(migrations.Migration):
to="eco.vocab",
),
),
("deprecated_on", models.DateTimeField(blank=True, default=None, null=True)),
],
options={
"verbose_name": "Controlled vocabulary",
Expand Down
10 changes: 0 additions & 10 deletions hawc/apps/eco/migrations/0006_update_vocab.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,6 @@ class Migration(migrations.Migration):
]

operations = [
migrations.AddField(
model_name="nestedterm",
name="deprecated_on",
field=models.DateTimeField(blank=True, default=None, null=True),
),
migrations.AddField(
model_name="vocab",
name="deprecated_on",
field=models.DateTimeField(blank=True, default=None, null=True),
),
migrations.AlterField(
model_name="design",
name="climates",
Expand Down
2 changes: 1 addition & 1 deletion hawc/apps/lit/migrations/0012_reference_authors_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def update_reference_authors(apps, schema_editor):
qs = Reference.objects.all().prefetch_related("identifiers")
n_total = Reference.objects.all().count()
updates = []
for idx, reference in enumerate(qs.iterator()):
for idx, reference in enumerate(qs.iterator(chunk_size=5000)):
if idx % 5000 == 0:
print(f"Updating reference authors {idx:,} of {n_total:,}")

Expand Down

0 comments on commit bdd47bb

Please sign in to comment.