Skip to content

Commit

Permalink
Fix migration issue by dropping existing Reviews before schema change (
Browse files Browse the repository at this point in the history
  • Loading branch information
GregKaleka authored Dec 19, 2024
1 parent b6cc320 commit 8acf75c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions versions/migrations/0016_drop_existing_reviews.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.16 on 2024-12-19 15:20

from django.db import migrations


def drop_existing_reviews(apps, schema_editor):
Review = apps.get_model("versions", "Review")
output = Review.objects.all().delete()
print(f"\nDeleted {output}...")


class Migration(migrations.Migration):
dependencies = [
("versions", "0015_drop_review_generated_stub_users"),
]
operations = [
migrations.RunPython(drop_existing_reviews, migrations.RunPython.noop),
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.16 on 2024-12-18 18:33
# Generated by Django 4.2.16 on 2024-12-19 15:20

from django.db import migrations, models
import django.db.models.deletion
Expand All @@ -8,7 +8,7 @@ class Migration(migrations.Migration):

dependencies = [
("libraries", "0027_libraryversion_dependencies"),
("versions", "0015_drop_review_generated_stub_users"),
("versions", "0016_drop_existing_reviews"),
]

operations = [
Expand Down

0 comments on commit 8acf75c

Please sign in to comment.