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:
parent
e94fee1e25
commit
292849e782
1 changed files with 5 additions and 1 deletions
|
|
@ -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'),
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue