Opened 3 weeks ago

Last modified 3 weeks ago

#35711 closed Bug

Running migrate with disabled migrations fails with version 5.1 — at Initial Version

Reported by: Mounir Owned by:
Component: Migrations Version: 5.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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()

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top