agendas: fix migration (#54969)

This commit is contained in:
Lauréline Guérin 2021-06-18 10:47:38 +02:00
parent f9b5089f06
commit 577a492cd2
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
2 changed files with 8 additions and 6 deletions

View File

@ -1,5 +1,5 @@
from dateutil.rrule import DAILY, WEEKLY
from django.db import migrations
from django.db import migrations, transaction
from django.db.utils import ProgrammingError
@ -49,8 +49,9 @@ class Migration(migrations.Migration):
def _check_db(self, project_state, schema_editor):
try:
# check if the column exists
schema_editor.execute('SELECT recurrence_rule FROM agendas_event')
with transaction.atomic():
# check if the column exists
schema_editor.execute('SELECT recurrence_rule FROM agendas_event')
except ProgrammingError:
# if not exists, ignore the migration
return project_state

View File

@ -1,4 +1,4 @@
from django.db import migrations
from django.db import migrations, transaction
from django.db.utils import ProgrammingError
@ -21,8 +21,9 @@ class Migration(migrations.Migration):
def _check_db(self, project_state, schema_editor):
try:
# check if the column exists
schema_editor.execute('SELECT recurrence_rule FROM agendas_event')
with transaction.atomic():
# check if the column exists
schema_editor.execute('SELECT recurrence_rule FROM agendas_event')
except ProgrammingError:
# if not exists, ignore the migration
return project_state