From bb21feba15b062c5e4d17a400adea1049713c0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonah=20Br=C3=BCchert?= Date: Thu, 23 May 2024 04:03:00 +0200 Subject: Adapt database migrations to current django API --- src/lib/Bcfg2/Server/Admin.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/lib/Bcfg2/Server/Admin.py b/src/lib/Bcfg2/Server/Admin.py index 30c04411a..8cdff9309 100644 --- a/src/lib/Bcfg2/Server/Admin.py +++ b/src/lib/Bcfg2/Server/Admin.py @@ -907,6 +907,7 @@ if HAS_DJANGO: class DBShell(_DjangoProxyCmd): """ Call the Django 'dbshell' command on the database """ + kwargs = {'database': 'Reporting'} class Shell(_DjangoProxyCmd): """ Call the Django 'shell' command on the database """ @@ -915,6 +916,11 @@ if HAS_DJANGO: """ Call the Django 'validate' command on the database """ command = "validate" + class Migrate(_DjangoProxyCmd): + """ Call the Django 'migrate' command on the database """ + command = "migrate" + kwargs = {'database': 'Reporting'} + class Syncdb(AdminCmd): """ Sync the Django ORM with the configured database """ @@ -932,16 +938,9 @@ if HAS_DJANGO: self.logger.error("Database update failed: %s" % err) raise SystemExit(1) - if django.VERSION[0] == 1 and django.VERSION[1] >= 7: - class Makemigrations(_DjangoProxyCmd): - """ Call the 'makemigrations' command on the database """ - args = ['Reporting'] - - else: - class Schemamigration(_DjangoProxyCmd): - """ Call the South 'schemamigration' command on the database """ - args = ['Bcfg2.Reporting'] - kwargs = {'auto': True} + class Makemigrations(_DjangoProxyCmd): + """ Call the 'makemigrations' command on the database """ + args = ['Reporting'] if HAS_REPORTS: -- cgit v1.2.3-1-g7c22