Merge pull request #4157 from emanuelschuetze/fix-history-migration

Fix history migration.
This commit is contained in:
Emanuel Schütze 2019-01-20 11:28:32 +01:00 committed by GitHub
commit f2ffe64f98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,16 @@ import jsonfield.fields
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):
dependencies = [
@ -17,6 +27,7 @@ class Migration(migrations.Migration):
name='restricted',
field=models.BooleanField(default=False),
),
migrations.RunPython(clear_history),
migrations.AlterField(
model_name='history',
name='information',