#35711: Running migrate with disabled migrations fails with version 5.1
------------------------+--------------------------------------
Reporter: Mounir | Type: Bug
Status: new | Component: Migrations
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------+--------------------------------------
For some tests I run the migrate with the --run-syncdb
Since the update to 5.1 (from 5.0) I get this error:
{{{
Operations to perform:
Apply all migrations: (none)
Running migrations:
No migrations to apply.
Traceback (most recent call last):
File "/app/./manage.py", line 30, in <module>
main()
File "/app/./manage.py", line 26, in main
execute_from_command_line(sys.argv)
File "/home/app/venv/lib/python3.12/site-
packages/django/core/management/__init__.py", line 442, in
execute_from_command_line
utility.execute()
File "/home/app/venv/lib/python3.12/site-
packages/django/core/management/__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/app/venv/lib/python3.12/site-
packages/django/core/management/base.py", line 413, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/app/venv/lib/python3.12/site-
packages/django/core/management/base.py", line 459, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/core/management/commands/migrate.py", line 21, in handle
super().handle(*args, **options)
File "/home/app/venv/lib/python3.12/site-
packages/django/core/management/base.py", line 107, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-
packages/django/core/management/commands/migrate.py", line 336, in handle
changes = autodetector.changes(graph=executor.loader.graph)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-
packages/django/db/migrations/autodetector.py", line 67, in changes
changes = self._detect_changes(convert_apps, graph)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-
packages/pgtrigger/migrations.py", line 156, in _detect_changes
return super()._detect_changes(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-
packages/django/db/migrations/autodetector.py", line 224, in
_detect_changes
self._sort_migrations()
File "/home/app/venv/lib/python3.12/site-
packages/django/db/migrations/autodetector.py", line 426, in
_sort_migrations
dep = self._resolve_dependency(dep)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/app/venv/lib/python3.12/site-
packages/django/db/migrations/autodetector.py", line 279, in
_resolve_dependency
if dependency.app_label != "__setting__":
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'tuple' object has no attribute 'app_label'
}}}
The disabling of migrations is done with the help of migration modules
setting:
{{{
class DisableMigrations:
def __contains__(self, item):
return True
def __getitem__(self, item):
return None
MIGRATION_MODULES = DisableMigrations()
}}}
--
Ticket URL: <
https://code.djangoproject.com/ticket/35711>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.