Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dylan-shipwell
Copy link

@dylan-shipwell dylan-shipwell commented Feb 7, 2023

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.

…bmodule

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.
@dylan-shipwell
Copy link
Author

ref #246

@dylan-shipwell
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant