Skip to content
Snippets Groups Projects
Commit 573c1efb authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch...

Merge branch '778-migrations-fail-when-chronos-is-installed-no-migrations-were-ever-run-before' into 'master'

Resolve "Migrations fail when Chronos is installed & no migrations were ever run before"

Closes #778

See merge request !1141
parents fa3057fa b550c8c4
No related branches found
No related tags found
1 merge request!1141Resolve "Migrations fail when Chronos is installed & no migrations were ever run before"
Pipeline #108640 canceled
......@@ -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):
......@@ -16,9 +18,17 @@ class Migration(migrations.Migration):
('core', '0046_notification_create_field_icon'),
]
# This migration must run after Chronos' migration 1 through 12, but before
# 13. That's because we are in fact moving a model, and we need to make sure
# that this migration runs at the right time.
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