Skip to content

Commit

Permalink
create less problems on migration
Browse files Browse the repository at this point in the history
  • Loading branch information
mwvolo committed Jan 30, 2024
1 parent 6d008f4 commit ea0a41b
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions snippets/migrations/0034_delete_assignableavailable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,12 @@

from django.db import migrations


def migrate_old_data(apps, schema_editor):
PromoteSnippet = apps.get_model("snippets", "PromoteSnippet")
AssignableAvailable = apps.get_model("snippets", "AssignableAvailable")
for assignable_snippet in AssignableAvailable.objects.all():
snippet = PromoteSnippet.objects.create(
name=assignable_snippet.name,
description=assignable_snippet.assignable_description,
image=assignable_snippet.image
)
snippet.save()

class Migration(migrations.Migration):
dependencies = [
("snippets", "0033_promotesnippet"),
]

operations = [
migrations.RunPython(migrate_old_data),
migrations.DeleteModel(
name="AssignableAvailable",
),
Expand Down

0 comments on commit ea0a41b

Please sign in to comment.