| Age | Commit message (Collapse) | Author |
|
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
|
|
target model changes.
Co-Authored-By: Jacob Walls <38668450+jacobtylerwalls@users.noreply.github.com>
Co-Authored-By: Clifford Gama <cliffygamy@gmail.com>
|
|
their base fields.
Thanks to Colton Saska for the report and to Simon Charette for the review.
|
|
Rewrapped long docstrings and block comments to 79 characters + newline
using script from https://github.com/medmunds/autofix-w505.
|
|
migrations.
|
|
|
|
|
|
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>
|
|
|
|
|
|
referenced by GeneratedField.expression.
Thank you to Simon Charette for the review.
|
|
Once the deprecation period ends CheckConstraint.check() can become the
documented method that performs system checks for BaseConstraint
subclasses.
|
|
optimizing migrations.
|
|
Field.db_default accepts either literal Python values or compilables
(as_sql) and wrap the former ones in Value internally.
While 1e38f11 added support for automatic resolving of output fields for
types such as str, int, float, and other unambigous ones it's cannot do
so for all types such as dict or even contrib.postgres and contrib.gis
primitives.
When a literal, non-compilable, value is provided it likely make the
most sense to bind its output field to the field its attached to avoid
forcing the user to provide an explicit `Value(output_field)`.
Thanks David Sanders for the report.
|
|
|
|
ForeignObject.from_fields/to_fields is not a tuple.
|
|
dict_keys.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
|
Special thanks to Hannes Ljungberg for finding multiple implementation
gaps.
Thanks also to Simon Charette, Adam Johnson, and Mariusz Felisiak for
reviews.
|
|
Meta.indexes/index_together when optimizing migrations.
This makes squashing migrations an available path for changing
Meta.index_together, which is deprecated, to Meta.indexes.
Follow up to f81032572107846922745b68d5b7191058fdd5f5.
|
|
index/constraint on new foreign key.
Thanks Simon Charette and David Wobrock for reviews.
|
|
graphlib.TopologicalSort().
graphlib.TopologicalSort() is available since Python 3.9.
|
|
Thanks Jared Chung, Tom Carrick, David Smith, Nick Pope, and Mariusz
Felisiak for reviews.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Nick Pope <nick@nickpope.me.uk>
|
|
Thanks to Bishal Gautam for the report and initial implementation.
Regression in fa58450a9ab8a1bdd2a5090b51b00078fd85ffa6.
Co-Authored-By: Bishal Gautam <bisalgt@gmail.com>
|
|
another app.
Regression in aa4acc164d1247c0de515c959f7b09648b57dc42.
Thanks bryangeplant for the report.
|
|
This also deprecates AlterIndexTogether migration operation.
|
|
|
|
|
|
ManyToManyField.
This makes AddField() used for altering to ManyToManyField, dependent
on the prior RemoveField.
|
|
indexes from index_together to Meta.indexes.
|
|
Meta.indexes.
|
|
pre-compiled regular expression.
|
|
lowercased swappable setting.
Thanks Chris Lee for the report.
Regression in 43289707809c814a70f0db38ca4f82f35f43dbfd.
Refs #23916.
|
|
|
|
|
|
Regression in aa4acc164d1247c0de515c959f7b09648b57dc42.
|
|
|
|
migrations autodetector.
The migration framework uniquely identifies models by case insensitive
labels composed of their app label and model names and so does the app
registry in most of its methods (e.g. AppConfig.get_model) but it
wasn't the case for get_swappable_settings_name() until this change.
This likely slipped under the radar for so long and only regressed in
b9df2b74b98b4d63933e8061d3cfc1f6f39eb747 because prior to the changes
related to the usage of model states instead of rendered models in the
auto-detector the exact value settings value was never going through a
case folding hoop.
Thanks Andrew Chen Wang for the report and Keryn Knight for the
investigation.
|
|
attribute.
Co-authored-by: Simon Charette <charette.s@gmail.com>
|
|
non-model class.
Regression in aa4acc164d1247c0de515c959f7b09648b57dc42.
Thanks Kevin Marsh for the report.
|
|
|
|
altering fields.
|
|
Thanks Jacob Walls for the report.
|
|
migrations.
|
|
|
|
ManyToManyField.
Fixed in aa4acc164d1247c0de515c959f7b09648b57dc42.
|
|
|
|
Thanks Simon Charette and Markus Holtermann for reviews.
|
|
52 gives 60 in total (52 + 5 + 3).
Co-authored-by: Adam Johnson <me@adamj.eu>
|
|
operations.
|
|
migrations "initial".
|