#35711: Running migrate with disabled migrations fails with version 5.1
----------------------------+--------------------------------------
Reporter: Mounir | Owner: (none)
Type: Bug | Status: new
Component: Migrations | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------------------------
Description changed by Mounir:
Old description:
> 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()
> }}}
New description:
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()
}}}
Possible regression from
https://github.com/django/django/commit/7dd3e694db17bc34f9ce73e516f853ebd16e19e7
--
--
Ticket URL: <https://code.djangoproject.com/ticket/35711#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107019194933928-5b1f5f96-f87e-49b7-ae2b-57568a93c987-000000%40eu-central-1.amazonses.com.