Fix history migration.
This commit is contained in:
parent
251cc4acc1
commit
c704b90ecb
@ -5,6 +5,16 @@ import jsonfield.fields
|
|||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
def clear_history(apps, schema_editor):
|
||||||
|
"""
|
||||||
|
Deletes the full history.
|
||||||
|
"""
|
||||||
|
# We get the model from the versioned app registry;
|
||||||
|
# if we directly import it, it will be the wrong version.
|
||||||
|
History = apps.get_model("core", "History")
|
||||||
|
History.objects.all().delete()
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
@ -17,6 +27,7 @@ class Migration(migrations.Migration):
|
|||||||
name='restricted',
|
name='restricted',
|
||||||
field=models.BooleanField(default=False),
|
field=models.BooleanField(default=False),
|
||||||
),
|
),
|
||||||
|
migrations.RunPython(clear_history),
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='history',
|
model_name='history',
|
||||||
name='information',
|
name='information',
|
||||||
|
Loading…
Reference in New Issue
Block a user