summaryrefslogtreecommitdiff
path: root/tests/migrations
AgeCommit message (Collapse)Author
2026-03-14Refs #12529, #22325 -- Fixed ExecutorTests.test_custom_user isolation.Mariusz Felisiak
2026-03-08Fixed #12529 -- Fixed migrate --run-syncdb crash for existing model with ↵Mariusz Felisiak
truncated db_table names.
2026-02-25Refs #36652, #36936 -- Improved path manipulation in a migration test ↵pmppk
launching a subprocess.
2026-02-10Added various missing test skips observed on MongoDB.Tim Graham
2026-02-02Fixed #36893 -- Serialized elidable kwarg for RunSQL and RunPython operations.SnippyCodes
2026-01-28Fixed #36878 -- Unified data type for *_together options in ModelState.Markus Holtermann
Ever since the beginning of Django's migration framework, there's been a bit of an inconsistency on how index_together and unique_together values have been stored on the ModelState[^1]. It's only really obvious, when looking at the current code for `from_model()`[^2] and the `rename_field()` state alteration code[^3]. The problem in the autodetector's detection of the `*_together` options as raised in the ticket, reinforces the inconsistency[^4]: the old value is being normalized to a set of tuples, whereas the new value is taken as-is. Why this hasn't been caught before, is likely to the fact, that we never really look at a `to_state` that comes from migration operations in the autodetector. Instead, in both usages in Django[^5], [^6] the `to_state` is a `ProjectState.from_apps()`. And that state is consistently using sets of tuples and not lists of lists. [^1]: https://github.com/django/django/commit/67dcea711e92025d0e8676b869b7ef15dbc6db73#diff-5dd147e9e978e645313dd99eab3a7bab1f1cb0a53e256843adb68aeed71e61dcR85-R87 [^2]: https://github.com/django/django/blob/b1ffa9a9d78b0c2c5ad6ed5a1d84e380d5cfd010/django/db/migrations/state.py#L842 [^3]: https://github.com/django/django/blob/b1ffa9a9d78b0c2c5ad6ed5a1d84e380d5cfd010/django/db/migrations/state.py#L340-L345 [^4]: https://github.com/django/django/blob/b1ffa9a9d78b0c2c5ad6ed5a1d84e380d5cfd010/django/db/migrations/autodetector.py#L1757-L1771 [^5]: https://github.com/django/django/blob/2351c1b12cc9cf82d642f769c774bc3ea0cc4006/django/core/management/commands/makemigrations.py#L215-L219 [^6]: https://github.com/django/django/blob/2351c1b12cc9cf82d642f769c774bc3ea0cc4006/django/core/management/commands/migrate.py#L329-L332
2026-01-18Applied Black's 2026 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/26.1.0
2025-12-19Fixed #36791 -- Made MigrationAutodetector recreate through table when m2m ↵Johanan Oppong Amoateng
target model changes. Co-Authored-By: Jacob Walls <38668450+jacobtylerwalls@users.noreply.github.com> Co-Authored-By: Clifford Gama <cliffygamy@gmail.com>
2025-12-15Refs #36652 -- Avoided missing imports in a temporary file generated in a ↵Jacob Walls
migration test.
2025-12-13Fixed #36765 -- Added support for stored GeneratedFields on Oracle 23ai/26ai ↵Mariusz Felisiak
(23.7+). Thanks Jacob Walls for the review.
2025-11-18Fixed #36141 -- Checked for applied replaced migrations recursively.Georgi Yanchev
Regression in 64b1ac7292c72d3551b2ad70b2a78c8fe4af3249.
2025-11-13Refs #31055 -- Augmented regression tests for database system checks.Simon Charette
We might want to change this in the future but it should be further discussed first.
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-11-03Fixed #36695 -- Fixed handling of parameterized generics in migration ↵Augusto Pontes
serialization. Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2025-10-18Fixed #21961 -- Added support for database-level delete options for ForeignKey.Mariusz Felisiak
Thanks Simon Charette for pair programming. Co-authored-by: Nick Stefan <NickStefan12@gmail.com> Co-authored-by: Akash Kumar Sen <71623442+Akash-Kumar-Sen@users.noreply.github.com> Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-09-29Fixed assertIndexExists() crash when non-index constraint exists on the same ↵Mariusz Felisiak
columns.
2025-09-05Fixed #36564 -- Changed DEFAULT_AUTO_FIELD from AutoField to BigAutoField.Tim Graham
2025-08-04Fixed #35972 -- Fixed lookup crashes after subquery annotations.Jacob Walls
2025-07-25Refs #36438 -- Made FieldOperation.references_field() detect references in ↵Clifford Gama
GeneratedField.expression. Thanks to Simon Charette for the suggestion and review.
2025-07-25Fixed #36438 -- Made MigrationAutodetector remove generated fields before ↵Clifford Gama
their base fields. Thanks to Colton Saska for the report and to Simon Charette for the review.
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-07-23Refs #36500 -- Shortened some long docstrings and comments.Mike Edmunds
Manually reformatted some long docstrings and comments that would be damaged by the to-be-applied autofixer script, in cases where editorial judgment seemed necessary for style or wording changes.
2025-07-23Removed double spaces after periods and within phrases.Sarah Boyce
2025-06-27Fixed #35595, #35962 -- Removed indexes and constraints before fields in ↵wookkl
migrations.
2025-06-23Fixed #35305 -- Avoided recreating constraints on fields renamed via db_column.Jacob Walls
2025-06-19Refs #35038 -- Reduced CreateModel/AlterConstraint operations when ↵Jacob Walls
optimizing migrations.
2025-05-13Fixed #36383 -- Improved migration serialization for functools.partial objects.Adam Johnson
2025-05-13Refs #36383 -- Added extra tests for serializing functools.partial in ↵Adam Johnson
tests/migrations/test_writer.py. This includes a test helper to better assert over the expected output. Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-05-13Refs #36383 -- Extended DeconstructibleSerializer to support non-identifier ↵Adam Johnson
keyword arguments. In Python, keyword arguments must normally be valid identifiers (i.e., variable names that follow Python's naming rules). However, Python dicts can have keys that aren't valid identifiers, like "foo-bar" or "123foo". This commit ensures that keyword arguments that are nt valid identifiers, are properly handled when deconstructing an object.
2025-05-12Fixed #33174 -- Fixed migrations crash for model inheriting from Generic[T].Thibaut Decombe
2025-04-16Fixed #36274 -- Added support for run_before and atomic in MigrationWriter.Mikuláš Poul
2025-04-01Fixed #36184 -- Allowed migrating forward to squashed migrations.Jacob Walls
2025-03-31Fixed #36265 -- Added support for serialization of ZoneInfo instances in ↵Song Junho
migrations.
2025-03-09Fixed #35487 -- Removed CASCADE from RemoveField() on PostgreSQL.petr.prikryl
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-authored-by: Adam Johnson <me@adamj.eu> Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2025-02-18Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.Mariusz Felisiak
datetime.UTC was added in Python 3.11.
2025-02-13Fixed #36146 -- Recorded applied/unapplied migrations recursively.Georgi Yanchev
2025-02-06Refs #22997 -- Prevented requesting a default value for auto fields.Ben Cail
2025-01-22Fixed #24529 -- Allowed double squashing of migrations.Georgi Yanchev
Co-authored-by: Raphael Gaschignard <raphael@rtpg.co>
2025-01-13Refs #373 -- Adjusted test allowing AutoField in composite primary keys.Simon Charette
This is not a properly supported feature yet and should be revisited by refs #35957.
2024-12-27Fixed #35991 -- Fixed crash when adding non-nullable field after renaming ↵Mariusz Felisiak
part of CompositePrimaryKey on SQLite.
2024-12-19Fixed #36016 -- Prevented traceback when quitting makemigrations with Ctrl-C.Aman Sharma
2024-12-17Fixed #35969 -- Disallowed specifying a USING clause for altered generated ↵lufafajoshua
field. PostgreSQL versions 16.5 and above no longer permit the use of a USING clause when changing the type of a generated column.
2024-12-17Fixed #34856 -- Fixed references to index_together in historical migrations.Andrés Reverón Molina
While AlterUniqueTogether has been documented to be still allowed in historical migrations for the foreseeable future it has been crashing since 2abf417c815c20 was merged because the latter removed support for Meta.index_together which the migration framework uses to render models to perform schema changes. CreateModel(options["unique_together"]) was also affected. Refs #27236. Co-authored-by: Simon Charette <charette.s@gmail.com>
2024-12-11Fixed #35920 -- Observed requires_system_checks in migrate and runserver.Jacob Walls
Before, the full suite of system checks was run by these commands regardless if requires_system_checks had been overridden. Co-authored-by: Simon Charette <charette.s@gmail.com>
2024-12-09Fixed #35935 -- Colorized system checks when running sqlmigrate.Jacob Walls
2024-11-29Fixed #35308 -- Handled OSError when launching code formatters.Jacob Walls
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2024-11-29Fixed #373 -- Added CompositePrimaryKey.Bendeguz Csirmaz
Thanks Lily Foote and Simon Charette for reviews and mentoring this Google Summer of Code 2024 project. Co-authored-by: Simon Charette <charette.s@gmail.com> Co-authored-by: Lily Foote <code@lilyf.org>
2024-11-28Fixed #35038 -- Created AlterConstraint operation.Salvo Polizzi
2024-11-28Refs #35038 -- Added test for drop and recreation of a constraint.Salvo Polizzi
2024-11-18Fixed #35882 -- Made migration questioner loop on all errors.Adam Johnson