summaryrefslogtreecommitdiff
path: root/tests/migrations/test_optimizer.py
AgeCommit message (Collapse)Author
2025-06-19Refs #35038 -- Reduced CreateModel/AlterConstraint operations when ↵Jacob Walls
optimizing migrations.
2024-11-28Fixed #35038 -- Created AlterConstraint operation.Salvo Polizzi
2024-09-03Fixed #35704 -- Fixed reduction for AddIndex subclasses.Adam Johnson
2024-08-30Fixed #35700 -- Added AlterModelTable and AlterModelTableComment reductions.Adam Johnson
2024-03-01Refs #35234 -- Deprecated CheckConstraint.check in favor of .condition.Simon Charette
Once the deprecation period ends CheckConstraint.check() can become the documented method that performs system checks for BaseConstraint subclasses.
2024-02-09Refs #34534 -- Reduced constraint operations with Meta.constraints when ↵Ben Cail
optimizing migrations.
2023-09-18Refs #27236 -- Removed Meta.index_together per deprecation timeline.Mariusz Felisiak
2023-05-09Refs #34534 -- Reduced Add/RemoveConstraint and Add/RenameIndex operations ↵Akash Kumar Sen
when optimizing migrations.
2023-05-03Fixed #34529, Refs #34525 -- Reduced index operations with ↵Mariusz Felisiak
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.
2023-05-01Fixed #34528 -- Reduced Add/RemoveIndex operations when optimizing migrations.Mariusz Felisiak
2023-02-24Fixed #34366 -- Reduced AlterField operations when optimizing migrations.Laurent Tramoy
2022-07-26Refs #27236 -- Reverted AlterIndexTogether deprecation.Mariusz Felisiak
This partly reverts a6385b382e05a614a99e5a5913d8e631823159a2.
2022-07-12Fixed #27236 -- Deprecated Meta.index_together in favor of Meta.indexes.David Wobrock
This also deprecates AlterIndexTogether migration operation.
2022-05-12Refs #27064 -- Added RenameIndex migration operation.David Wobrock
2022-03-11Fixed #33572 -- Implemented CreateModel/AlterModelManagers reduction.Adam Johnson
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-02-19Fixed #32256 -- Fixed migration optimization crash when swapping field names.Hasan Ramezani
This disables optimization of RenameField operation when an old field name is referenced in subsequent operations. Co-authored-by: InvalidInterrupt <InvalidInterrupt@users.noreply.github.com>
2020-12-18Fixed #32262 -- Fixed migration optimization for model creation and Meta ↵Hasan Ramezani
options removal.
2020-04-09Refs #22608 -- Made app_label required when optimizing migrations.Simon Charette
This paved the way for the removal of lot of logic when app_label was not specified.
2019-01-21Made assertOptimizesTo() more strict in migrations tests.Vytis Banaitis
A recursive deconstruction is needed because comparing deconstructed operations doesn't check field attributes. Fixed typo in failing test.
2018-07-19Fixed #27731 -- Implemented CreateModel/AlterFooOperation reduction.Simon Charette
This should alleviate the side effects of disabling the AlterFooOperation reduction with RemoveField to fix refs #28862 during migration squashing because CreateModel can perform a reduction with RemoveField. Thanks Nick Pope for the review.
2018-07-19Fixed #28862 -- Disabled optimization of AlterFooTogether and RemoveField.Simon Charette
AlterFooTogether operations cannot be swapped with RemoveField operations on the same model as they could be removing the the same field as well. Since AlterFooTogether operations don't track what their previous value was, it's impossible to determine whether or not the optimization is safe so the only way to proceed is to disable the optimization. Thanks Ramiro Morales for the in-depth analysis of the issue. Refs #24828
2018-07-11Fixed #27845 -- Allowed both right and left optimizations of operations.Simon Charette
Thanks Raphael Gaschignard for the suggestion.
2018-07-11Fixed #26720 -- Prevented invalid CreateModel optimizations of related fields.Simon Charette
2018-07-11Fixed #27768 -- Allowed migration optimization of CreateModel order.Simon Charette
Thanks Ed Morley from Mozilla for the tests.
2018-07-10Refs #22875 -- Fixed an optimizer test to use a valid scenario.Simon Charette
An explicit intermediary many-to-many relationship must declare forward and reverse foreign keys. The original issue was in the autodetector as these operations shouldn't have been generated in this order in the first place which is tested by AutodetectorTests.test_create_with_through_model.
2017-12-28Removed unnecessary trailing commas and spaces in various code.Mariusz Felisiak
2017-01-25Simplified tests with assertDoesNotOptimize().Ed Morley
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2017-01-10Fixed #27717 -- Allowed migration optimization across AlterModelOptions.Ed Morley
2016-11-10Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings.za
2016-06-06Fixed #26710 -- Made CreateModel.references_model() take app_label into account.Sergey Fedoseev
2016-04-27Fixed #26521 -- Validated CreateModel bases, fields and managers for duplicates.James Robert
2016-01-23Fixed #24109 -- Allowed RunSQL and RunPython operations to be elided.Simon Charette
Thanks to Markus Holtermann and Tim Graham for their review.
2015-09-12Fixed #23395 -- Limited line lengths to 119 characters.Dražen Odobašić
2015-07-27Fixed #21127 -- Started deprecation toward requiring on_delete for ↵Flavio Curella
ForeignKey/OneToOneField
2015-06-16Fixed #24828 -- Allowed migration optimization across AlterFooTogetherMarkus Holtermann
The idea behind this change is, that AlterUniqueTogether, AlterIndexTogether and AlterOrderWithRespectTo can always be moved after an Add/Alter/Rename/RemoveField operation if they don't refer to the respective field and are not empty sets / None. Combined with the optimizations of duplicate AlterUniqueTogether, AlterIndexTogether, and AlterOrderWithRespectTo operations from 128caa1e16ec2627737748f75c8e55600a3df97f, these operations are optimized in a later round of the optimizer. Thanks Tim Graham for the review.
2015-06-14Optimized duplicate AlterModelTable/AlterFooTogether/AlterOWRTMarkus Holtermann
Thanks Andrew Godwin for the review.
2015-06-14Took AlterOrderWithRespectTo into account when optimizing migrationsMarkus Holtermann
Thanks Andrew Godwin for the review.
2015-05-20Refs #24652 -- Used SimpleTestCase where appropriate.Simon Charette
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2015-01-07Refs #23822 -- Made MigrationOptimizer aware of model managersMarkus Holtermann
2014-11-20Fixed #23844 -- Used topological sort for migration operation dependency ↵Patryk Zawadzki
resolution. This removes the concept of equality between operations to guarantee compatilibity with Python 3. Python 3 requires equality to result in identical object hashes. It's impossible to implement a unique hash that preserves equality as operations such as field creation depend on being able to accept arbitrary dicts that cannot be hashed reliably. Thanks Klaas van Schelven for the original patch in 13d613f80011852404198dfafd1f09c0c0ea42e6.
2014-06-22Fixed #22875: Optimizer did not take through= into account.Andrew Godwin
2014-05-15Harmonized some PEP 0263 coding preamblesClaude Paroz
2013-11-06flake8 fixesAlex Gaynor
2013-11-06Massive migration optimiser improvements + RenameModel opnAndrew Godwin
2013-11-03Fixed all E251 violationsAlex Gaynor
2013-11-02Fixed #21302 -- Fixed unused imports and import *.Tim Graham