3YOURMIND / django-migration-linter

:rocket: Detect backward incompatible migrations for your django project
https://pypi.python.org/pypi/django-migration-linter/
Apache License 2.0
530 stars 58 forks source link

contrib-nested-django-apps, mapping migration files from nested django apps #248

Open dylan-shipwell opened 1 year ago

dylan-shipwell commented 1 year ago

support migrations discovered within a submodule

this feature requires an opt-in flag, named --resolve-nested-apps. enabling this flag will attempt to map migration files to django.apps.apps.app_configs by using both's relative path to self.django_path (or settings.BASE_DIR). if the app_config's relative path matches the migration files's parent folder's relative path, that is considered a match and the migration is associated with the app_config.label for later lookups.

specifically, django-migration-linter presently assumes the app_config's label is going to be the foldername of the pymodule, which must be the django default when no AppConfig class provides a label. This pattern does not work for nested apps, it does not map migration files to app_labels correctly, meaning these app's and their migrations are skipped during linting.

dylan-shipwell commented 1 year ago

ref https://github.com/3YOURMIND/django-migration-linter/issues/246

dylan-shipwell commented 1 year ago

PS, after this is closed, the repo dylan-shipwell:contrib-nested-django-apps will be closed as it was moved to shipwell:contrib-nested-django-apps