fix relation already exists (#660)

Signed-off-by: DavidSpek <vanderspek.david@gmail.com>

Signed-off-by: DavidSpek <vanderspek.david@gmail.com>
This commit is contained in:
David van der Spek 2022-10-18 15:04:27 +02:00 committed by GitHub
parent e94fee1e25
commit 292849e782
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,6 @@
# Generated by Django 3.2.13 on 2022-07-20 09:04
from django.db import migrations, models, OperationalError
from django.db import migrations, models, OperationalError, ProgrammingError
class AddFieldIfNotExists(migrations.AddField):
@ -14,6 +14,9 @@ class AddFieldIfNotExists(migrations.AddField):
super().database_forwards(app_label, schema_editor, from_state, to_state)
except OperationalError:
pass
except ProgrammingError as e: # ignore if the field already exists
if "already exists" in str(e):
pass
def database_backwards(self, app_label, schema_editor, from_state, to_state):
pass
@ -27,6 +30,7 @@ class Migration(migrations.Migration):
it will recreate these fields.
"""
atomic = False
dependencies = [
('alerts', '0004_auto_20220711_1106'),
]