Skip to content

Commit

Permalink
add migration to clean class data
Browse files Browse the repository at this point in the history
  • Loading branch information
evemartin committed Jul 30, 2024
1 parent f824c4d commit 9e69ce8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cfl_common/common/migrations/0053_clean_class_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django.db import migrations, models

def clean_dirty_data(apps: Apps, *args):
Class = apps.get_model("common", "Class")

Class.objects.filter(
creation_time.year = 2015
).update(creation_time = null)

class Migration(migrations.Migration):
dependencies = [("common", "0052_add_cse_fields")],
operations = [
migrations.RunPython(
code=clean_dirty_data,
reverse_code=migrations.RunPython.noop,
),
]

0 comments on commit 9e69ce8

Please sign in to comment.