summaryrefslogtreecommitdiff
path: root/django/db/migrations/loader.py
AgeCommit message (Collapse)Author
2025-11-18Fixed #36141 -- Checked for applied replaced migrations recursively.Georgi Yanchev
Regression in 64b1ac7292c72d3551b2ad70b2a78c8fe4af3249.
2025-11-04Fixed #36652 -- Increased determinism when loading migrations from disk.Jayden Kneller
Ordering still depends on pkgutil.iter_modules, which does not guarantee order, but at least now Django is not introducing additional indeterminism, causing CircularDependencyError to appear or not appear in some edge cases. Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2025-01-22Fixed #24529 -- Allowed double squashing of migrations.Georgi Yanchev
Co-authored-by: Raphael Gaschignard <raphael@rtpg.co>
2025-01-22Refs #24529 -- Added replace_migration hook to MigrationLoader.Georgi Yanchev
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-08-11Refs #29898 -- Changed ProjectState.real_apps to set.Mariusz Felisiak
2021-08-04Fixed typos in migrations tests, comments, and error message.Jacob Walls
2020-12-29Fixed #32302 -- Allowed migrations to be loaded from regular packages with ↵William Schwartz
no __file__ attribute. The migrations loader prevents the use of PEP-420 namespace packages for holding apps' migrations modules. Previously the loader tested for this only by checking that app.migrations.__file__ is present. This prevented migrations' being found in frozen Python environments that don't set __file__ on any modules. Now the loader *additionally* checks whether app.migrations.__path__ is a list because namespace packages use a different type for __path__. Namespace packages continue to be forbidden, and, in fact, users of normal Python environments should experience no change whatsoever.
2020-07-22Reverted "Fixed #30300 -- Allowed migrations to be loaded from directories ↵Tim Graham
without __init__.py file." This reverts commit 3cd3bebe8921e14b911b36b2a1cbceef8fb6294e.
2020-07-10Sorted conflicting migrations by names.François Freitag
2020-04-20Fixed #24559 -- Made MigrationLoader.load_disk() catch more specific ↵Jon Dufresne
ModuleNotFoundError. Avoids inspecting the exception message, which is not considered a stable API and can change across Python versions. ModuleNotFoundError was introduced in Python 3.6. It is a subclass of ImportError that is raised when the imported module does not exist. It is not raised for other errors that can occur during an import. This exception instance has the property "name" which holds the name of module that failed to import.
2020-03-09Fixed #31318 -- Allowed sqlmigrate to inspect squashed migrations.David Wobrock
2020-03-09Refs #31318 -- Moved MigrationExecutor.collect_sql() to MigrationLoader.David Wobrock
collect_sql() is used only in sqlmigrate.
2020-01-20Changed re-raising an exception to use bare raise syntax where appropriate.Jon Dufresne
2019-10-10Fixed #30300 -- Allowed migrations to be loaded from directories without ↵Benjy Weinberger
__init__.py file.
2019-03-07Refs #30186 -- Changed MigrationRecorder.applied_migrations() to return a dict.Tim Schilling
2018-10-09Capitalized "Python" in docs and comments.Jon Dufresne
2018-09-11Fixed #29749 -- Made the migrations loader ignore files starting with a ↵Tim Graham
tilde or underscore. Regression in 29150d5da880ac1db15e47052330790cf1b802d2.
2018-09-10Fixed #29243 -- Improved efficiency of migration graph algorithm.Krzysztof Gogolewski
2018-03-23Fixed #23406 -- Allowed migrations to be loaded from .pyc files.Dan Watson
2018-02-05Refs #28814 -- Fixed migrations crash with namespace packages on Python 3.7.Tim Graham
Due to https://bugs.python.org/issue32303.
2018-01-12Fixed #28996 -- Simplified some boolean constructs and removed trivial ↵Дилян Палаузов
continue statements.
2017-12-04Fixed #28860 -- Removed unnecessary len() calls.Дилян Палаузов
2017-07-31Avoided creating temporary lists for obtaining the first item.Sergey Fedoseev
2017-02-28Refs #27656 -- Updated django.db docstring verbs according to PEP 257.Anton Samarchyan
2017-01-22Refs #23919 -- Replaced six.reraise by raiseClaude Paroz
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2017-01-18Refs #23919 -- Removed most of remaining six usageClaude Paroz
Thanks Tim Graham for the review.
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2016-11-14Fixed #27463 -- Fixed E741 flake8 warnings.Ramin Farajpour Cami
2016-09-01Fixed #27142, #27110 -- Made makemigrations consistency checks respect ↵Tim Graham
database routers. Partially reverted refs #27054 except for one of the tests as this solution supersedes that one. Thanks Shai Berger for the review.
2016-08-30Fixed #25109 -- Stopped silencing explicitly specified migration modules ↵Simon Charette
import errors. Thanks Tim for the review.
2016-08-23Fixed #27089 -- Added database alias to InconsistentMigrationHistory message.Tim Graham
2016-08-18Fixed #27054 -- Fixed makemigrations crash with a read-only database.Jim Nicholls
2016-08-05Fixed #27004 -- Made migrations consistency check ignore unapplied squashed ↵Jarek Glowacki
migrations.
2016-07-14Reverted "Fixed #25388 -- Added an option to allow disabling of migrations ↵Tim Graham
during test database creation" This reverts commit 157d7f1f1de4705daddebb77f21bd7097a74513d since it disables migrations all the time, not just during tests.
2016-05-08Fixed #25945, #26292 -- Refactored MigrationLoader.build_graph()Jarek Glowacki
2016-04-05Fixed #25850 -- Made migrate/makemigrations error on inconsistent history.Attila Tovt
2016-03-23Fixed #25388 -- Added an option to allow disabling of migrations during test ↵Berker Peksag
database creation
2015-12-03Fixed #25761 -- Added __cause__.__traceback__ to reraised exceptions.Raphaël Hertzog
When Django reraises an exception, it sets the __cause__ attribute even in Python 2, mimicking Python's 3 behavior for "raise Foo from Bar". However, Python 3 also ensures that all exceptions have a __traceback__ attribute and thus the "traceback2" Python 2 module (backport of Python 3's "traceback" module) relies on the fact that whenever you have a __cause__ attribute, the recorded exception also has a __traceback__ attribute. This is breaking testtools which is using traceback2 (see https://github.com/testing-cabal/testtools/issues/162). This commit fixes this inconsistency by ensuring that Django sets the __traceback__ attribute on any exception stored in a __cause__ attribute of a reraised exception.
2015-10-28Refs #25618 -- Removed detection of south migrations in loader.Tim Graham
It doesn't seem relevant for anyone upgrading to Django 1.10 and beyond.
2015-09-12Fixed #23395 -- Limited line lengths to 119 characters.Dražen Odobašić
2015-09-12Fixed #24919 -- Allowed disabling of migrations on a per app basisMarkus Holtermann
2015-06-02Fixed #24628 -- Fixed applied status for squashed migrations.Carl Meyer
2015-06-02Fixed #24895 -- Fixed loading a pair of squashed migrations with a dependency.Carl Meyer
2015-05-25Fixed #24848 -- Fixed ValueError for faulty migrations module.Marten Kenbeek
Added apps to unmigrated apps if the migrations module is a file or a folder missing __init__.py. Thanks to Ernest0x for the bug report.
2015-05-02Moved migration exception classes to shared moduleMarkus Holtermann
Thanks Aymeric Augustin for the review.
2015-02-07Revert "Fixed #24075 -- Prevented running post_migrate signals when ↵Markus Holtermann
unapplying initial migrations of contenttypes and auth" This reverts commit 737d24923ac69bb8b89af1bb2f3f4c4c744349e8.