Skip to content
Snippets Groups Projects
Commit 08cea1c3 authored by Nik | Klampfradler's avatar Nik | Klampfradler Committed by Hangzhi Yu
Browse files

Catch error in 0047_add_room_model on empty database

parent adc31fba
No related branches found
No related tags found
1 merge request!1141Resolve "Migrations fail when Chronos is installed & no migrations were ever run before"
......@@ -3,10 +3,12 @@
from django.apps import apps
import django.contrib.sites.managers
from django.db import migrations, models
from django.db.utils import ProgrammingError
import django.db.models.deletion
import django.utils.timezone
import oauth2_provider.generators
import oauth2_provider.models
from psycopg2.errors import UndefinedTable
class Migration(migrations.Migration):
......@@ -18,7 +20,12 @@ class Migration(migrations.Migration):
if "chronos" in apps.app_configs:
recorder = migrations.recorder
if not recorder.MigrationRecorder.Migration.objects.filter(app="core", name="0046_add_room_model").exists():
applied = False
try:
applied = recorder.MigrationRecorder.Migration.objects.filter(app="core", name="0046_add_room_model").exists()
except ProgrammingError:
applied = False
if not applied:
dependencies.append(('chronos', '0012_add_supervision_global_permission'))
operations = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment