| Age | Commit message (Collapse) | Author | |
|---|---|---|---|
| 2026-01-28 | Fixed #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 | |||
| 2025-07-23 | Refs #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-23 | Refs #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-05-12 | Fixed #33174 -- Fixed migrations crash for model inheriting from Generic[T]. | Thibaut Decombe | |
| 2024-12-27 | Fixed #35991 -- Fixed crash when adding non-nullable field after renaming ↵ | Mariusz Felisiak | |
| part of CompositePrimaryKey on SQLite. | |||
| 2024-12-17 | Fixed #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-17 | Refs #27236 -- Removed references to index_together from ModelState.from_model. | Simon Charette | |
| It's not possible for ModelMeta.index_together to exist anymore. | |||
| 2024-11-28 | Fixed #35038 -- Created AlterConstraint operation. | Salvo Polizzi | |
| 2024-07-10 | Fixed #35424 -- Checked order_with_respect_to is available when migrating ↵ | Daniel Patrick | |
| _order fields. Migrations would crash following the removal of an order_with_respect_to field from a model and the addition of an _order field. | |||
| 2024-01-26 | Applied Black's 2024 stable style. | Mariusz Felisiak | |
| https://github.com/psf/black/releases/tag/24.1.0 | |||
| 2023-11-23 | Fixed #26827 -- Improved ModelState error message when relations refer model ↵ | Prashant Pandey | |
| classes. | |||
| 2023-09-18 | Refs #27236 -- Removed Meta.index_together per deprecation timeline. | Mariusz Felisiak | |
| 2022-07-16 | Fixed #33848 -- Optimized StateApps.clone(). | Iuri de Silvio | |
| 2022-05-12 | Refs #27064 -- Added RenameIndex migration operation. | David Wobrock | |
| 2022-02-07 | Refs #33476 -- Refactored code to strictly match 88 characters line length. | Mariusz Felisiak | |
| 2022-02-07 | Refs #33476 -- Reformatted code with Black. | django-bot | |
| 2022-01-21 | Fixed #33449 -- Fixed makemigrations crash on models without ↵ | Fabian Büchler | |
| Meta.order_with_respect_to but with _order field. Regression in aa4acc164d1247c0de515c959f7b09648b57dc42. | |||
| 2021-11-02 | Fixed #33234 -- Fixed autodetector crash for proxy models inheriting from ↵ | Mariusz Felisiak | |
| non-model class. Regression in aa4acc164d1247c0de515c959f7b09648b57dc42. Thanks Kevin Marsh for the report. | |||
| 2021-08-26 | Refs #29898 -- Changed fields in ProjectState's relation registry to dict. | Mariusz Felisiak | |
| 2021-08-25 | Refs #29898 -- Made ProjectState encapsulate alterations in relations registry. | Manav Agarwal | |
| Thanks Simon Charette and Chris Jerdonek for reviews. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> | |||
| 2021-08-20 | Refs #29898 -- Refactored out ↵ | Manav Agarwal | |
| ProjectState.resolve_model_relations()/resolve_model_field_relations() hooks. | |||
| 2021-08-19 | Fixed #33014 -- Made ProjectState raise exception when real_apps argument is ↵ | Chris Jerdonek | |
| not a set. | |||
| 2021-08-11 | Refs #29898 -- Changed ProjectState.real_apps to set. | Mariusz Felisiak | |
| 2021-06-29 | Refs #29898 -- Moved state_forwards()'s logic from migration operations to ↵ | manav014 | |
| ProjectState. Thanks Simon Charette and Markus Holtermann for reviews. | |||
| 2021-04-16 | Fixed #29899 -- Made autodetector use model states instead of model classes. | David Wobrock | |
| Thanks Simon Charette and Markus Holtermann for reviews. | |||
| 2020-12-22 | Refs #32285 -- Made AppConfigStub do not call super().__init__(). | Hasan Ramezani | |
| Calling super().__init__() is unnecessary and enforces the use of various workarounds. | |||
| 2020-04-22 | Fixed #31499 -- Stored ModelState.fields into a dict. | Simon Charette | |
| This allows the removal of its O(n) .get_field_by_name method and many other awkward access patterns. While fields were initially stored in a list to preserve the initial model definiton field ordering the auto-detector doesn't take field ordering into account and no operations exists to reorder fields of a model. This makes the preservation of the field ordering completely superflous because field reorganization after the creation of the model state wouldn't be taken into account. | |||
| 2020-04-22 | Refs #31499 -- Ignored field ordering to determine ModelState equality. | Simon Charette | |
| 2020-02-04 | Simplified imports from django.db and django.contrib.gis.db. | Nick Pope | |
| 2019-02-06 | Fixed #30159 -- Removed unneeded use of OrderedDict. | Nick Pope | |
| Dicts preserve order since Python 3.6. | |||
| 2019-01-13 | Fixed #27685 -- Added watchman support to the autoreloader. | Tom Forbes | |
| Removed support for pyinotify (refs #9722). | |||
| 2018-09-28 | Refs #28909 -- Simplifed code using unpacking generalizations. | Sergey Fedoseev | |
| 2018-07-10 | Fixed #11964 -- Added support for database check constraints. | Ian Foote | |
| 2017-12-28 | Removed unnecessary trailing commas and spaces in various code. | Mariusz Felisiak | |
| 2017-12-11 | Fixed #28909 -- Simplified code using tuple/list/set/dict unpacking. | Nick Pope | |
| 2017-09-10 | Removed unnecessary parens in _get_app_label_and_model_name(). | Mariusz Felisiak | |
| 2017-09-07 | Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()." | Tim Graham | |
| This reverts commit 550cb3a365dee4edfdd1563224d5304de2a57fda because try/except performs better. | |||
| 2017-08-25 | Simplified migrations.state.ProjectState.__eq__(). | Sergey Fedoseev | |
| 2017-06-28 | Fixed #27818 -- Replaced try/except/pass with contextlib.suppress(). | Mads Jensen | |
| 2017-06-01 | Refs #23968 -- Removed unnecessary lists, generators, and tuple calls. | Jon Dufresne | |
| 2017-05-27 | Fixed #28249 -- Removed unnecessary dict.keys() calls. | Jon Dufresne | |
| iter(dict) is equivalent to iter(dict.keys()). | |||
| 2017-05-01 | Fixed #28043 -- Prevented AddIndex and RemoveIndex from mutating model state. | Ian Foote | |
| 2017-04-07 | Fixed #28051 -- Made migrations respect Index's name argument. | Markus Holtermann | |
| Thanks Marc Tamlyn for the report and Tim Graham for the review. | |||
| 2017-03-21 | Fixed #27915 -- Allowed Meta.indexes to be defined in abstract models. | Tim Graham | |
| Thanks Markus Holtermann for review. | |||
| 2017-03-04 | Refs #27795 -- Removed unneeded force_text calls | Claude Paroz | |
| Thanks Tim Graham for the review. | |||
| 2017-02-28 | Refs #27656 -- Updated django.db docstring verbs according to PEP 257. | Anton Samarchyan | |
| 2017-01-25 | Refs #23919 -- Replaced super(ClassName, self) with super(). | chillaranand | |
| 2017-01-22 | Removed obsolete force_text_recursive | Claude Paroz | |
| 2017-01-19 | Refs #23919 -- Removed str() conversion of type and method __name__. | Simon Charette | |
| 2017-01-19 | Refs #23919 -- Stopped inheriting from object to define new style classes. | Simon Charette | |
