mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
fail CI if the change includes model changes that are missing migrations
This commit is contained in:
1
Makefile
1
Makefile
@@ -382,6 +382,7 @@ test:
|
|||||||
. $(VENV_BASE)/awx/bin/activate; \
|
. $(VENV_BASE)/awx/bin/activate; \
|
||||||
fi; \
|
fi; \
|
||||||
py.test -n auto $(TEST_DIRS)
|
py.test -n auto $(TEST_DIRS)
|
||||||
|
awx-manage check_migrations --dry-run --check -n 'vNNN_missing_migration_file'
|
||||||
|
|
||||||
test_combined: test_ansible test
|
test_combined: test_ansible test
|
||||||
|
|
||||||
|
|||||||
12
awx/main/management/commands/check_migrations.py
Normal file
12
awx/main/management/commands/check_migrations.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
from django.db import connections
|
||||||
|
from django.db.backends.sqlite3.base import DatabaseWrapper
|
||||||
|
from django.core.management.commands.makemigrations import Command as MakeMigrations
|
||||||
|
|
||||||
|
|
||||||
|
class Command(MakeMigrations):
|
||||||
|
|
||||||
|
def execute(self, *args, **options):
|
||||||
|
settings = connections['default'].settings_dict.copy()
|
||||||
|
settings['ENGINE'] = 'sqlite3'
|
||||||
|
connections['default'] = DatabaseWrapper(settings)
|
||||||
|
return MakeMigrations().execute(*args, **options)
|
||||||
Reference in New Issue
Block a user