From e117a150c04ba21ab2589f99d270bdc6bd7dd8be Mon Sep 17 00:00:00 2001 From: Erwan Rouchet <rouchet@teklia.com> Date: Mon, 14 Dec 2020 14:20:35 +0100 Subject: [PATCH] Early return in migration --- arkindex/documents/migrations/0024_migrate_datasource.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arkindex/documents/migrations/0024_migrate_datasource.py b/arkindex/documents/migrations/0024_migrate_datasource.py index 7ba7bd5cd8..b164ee3621 100644 --- a/arkindex/documents/migrations/0024_migrate_datasource.py +++ b/arkindex/documents/migrations/0024_migrate_datasource.py @@ -9,9 +9,12 @@ from arkindex.dataimport.models import RepositoryType def migrate_data_sources(apps, schema_editor): + DataSource = apps.get_model('documents', 'DataSource') + if not DataSource.objects.exists(): + return + repo_prefix = os.environ.get('REPOSITORY_PREFIX', 'https://gitlab.com/teklia/workers') - DataSource = apps.get_model('documents', 'DataSource') Element = apps.get_model('documents', 'Element') Classification = apps.get_model('documents', 'Classification') Transcription = apps.get_model('documents', 'Transcription') -- GitLab