summaryrefslogtreecommitdiff
path: root/tests/migrations
AgeCommit message (Collapse)Author
2024-11-18Refs #35882 -- Added test for migration questioner KeyboardInterrupt.Adam Johnson
2024-10-15Fixed #35656 -- Added an autodetector attribute to the makemigrations and ↵leondaz
migrate commands.
2024-09-03Fixed #35704 -- Fixed reduction for AddIndex subclasses.Adam Johnson
2024-09-03Fixed #35724 -- Tested migration commands handling of distributed namespace ↵Jacob Walls
packages. Also increased coverage of module_loading.py.
2024-08-30Fixed #35700 -- Added AlterModelTable and AlterModelTableComment reductions.Adam Johnson
2024-08-01Reverted "Fixed #28646 -- Prevented duplicate index when unique is set to ↵Sarah Boyce
True on PostgreSQL." This reverts commit 9cf9c796be8dd53bc3b11355ff39d65c81d7be6d due to a crash on Oracle as it didn't allow multiple indexes on the same field.
2024-07-30Fixed #28646 -- Prevented duplicate index when unique is set to True on ↵Ben Cail
PostgreSQL.
2024-07-25Fixed #35625 -- Fixed a crash when adding a field with db_default and check ↵Simon Charette
constraint. This is the exact same issue as refs #30408 but for creating a model with a constraint containing % escapes instead of column addition. All of these issues stem from a lack of SQL and parameters separation from the BaseConstraint DDL generating methods preventing them from being mixed with other parts of the schema alteration logic that do make use of parametrization on some backends (e.g. Postgres, MySQL for DEFAULT). Prior to the addition of Field.db_default and GeneratedField in 5.0 parametrization of DDL was never exercised on model creation so this is effectively a bug with db_default as the GeneratedField case was addressed by refs #35336. Thanks Julien Chaumont for the report and Mariusz Felisiak for the review.
2024-07-10Fixed #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-06-14Refs #34881 -- Fixed ↵Mariusz Felisiak
OperationTests.test_rename_m2m_field_with_2_references() test on Oracle.
2024-06-13Fixed #34881 -- Fixed a crash when renaming a model with multiple ↵Anže Pečar
ManyToManyField.through references on SQLite. Thank you to dennisvang for the report and Jase Hackman for the test. Co-authored-by: Jase Hackman <jase.hackman@zapier.com>
2024-05-23Fixed typo in migrations test name.Tim Graham
2024-05-03Fixed #35422 -- Fixed migrations crash when altering GeneratedField ↵Mariusz Felisiak
referencing rename field. Thanks Sarah Boyce for the report and Simon Charette for the implementation idea.
2024-05-02Fixed #35359 -- Fixed migration operations ordering when adding fields ↵DevilsAutumn
referenced by GeneratedField.expression. Thank you to Simon Charette for the review.
2024-03-25Increased test coverage for django.db.migrations.operations.special.Mariusz Felisiak
2024-03-22Added ModelState.from_model() test for abstract model with unnamed indexes.Mariusz Felisiak
2024-03-14Fixed #28541 -- Fixed migrations crash when changing primary key on SQLite.Ben Cail
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-13Fixed #35122 -- Made migrate --prune option respect --app_label.Moein Bbp
2024-02-09Fixed #35175 -- Made migraton writer preserve keyword-only arguments.David Sanders
Thanks Gerald Goh for the report.
2024-02-09Refs #34534 -- Reduced constraint operations with Meta.constraints when ↵Ben Cail
optimizing migrations.
2024-02-04Fixed #35149 -- Fixed crashes of db_default with unresolvable output field.Simon Charette
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.
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2024-01-17Fixed #31700 -- Made makemigrations command display meaningful symbols for ↵Amir Karimi
each operation.
2023-12-22Fixed #35022 -- Fixed RenameIndex() crash on unnamed indexes if exists ↵David Wobrock
unique constraint on the same fields.
2023-11-23Fixed #26827 -- Improved ModelState error message when relations refer model ↵Prashant Pandey
classes.
2023-11-22Fixed #34984 -- Skipped GeneratedFields when remaking tables on SQLite.Sarah Boyce
Regression in f333e3513e8bdf5ffeb6eeb63021c230082e6f95.t Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-authored-by: David Sanders <shang.xiao.sanders@gmail.com>
2023-11-14Fixed #34944 -- Made GeneratedField.output_field required.Mariusz Felisiak
Regression in f333e3513e8bdf5ffeb6eeb63021c230082e6f95.
2023-11-09Fixed #34457 -- Restored output for makemigrations --check.Adam Johnson
Co-authored-by: David Sanders <shang.xiao.sanders@gmail.com> Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2023-11-07Fixed #34946 -- Preserved db_default on combined default field addition.Simon Charette
Regression in 7414704e88d73dafbcfbb85f9bc54cb6111439d3.
2023-11-02Refs #34936 -- Added test for altering DecimalField with db_default to ↵David Sanders
non-nullable.
2023-09-18Refs #27236 -- Removed Meta.index_together per deprecation timeline.Mariusz Felisiak
2023-09-14Fixed #24561 -- Added support for callables on model fields' choices.Natalia
2023-09-13Fixed #34822 -- Added support for serializing functions decorated with ↵Nick Pope
functools.lru_cache in migrations. `@functools.cache` and `@functools.lru_cache` return an object of type `functools._lru_cache_wrapper` which prevented the migrations serializer from working. Simply using the existing `FunctionTypeSerializer` for this additional type works as expected.
2023-09-13Refs #34822 -- Added tests for serializing decorated functions in migrations.Nick Pope
Functions decorated with a decorator that is properly wrapped, e.g. by using `@functools.wraps`, are already supported.
2023-09-11Fixed #34824 -- Prevented unnecessary AlterField when ↵donghao
ForeignObject.from_fields/to_fields is not a tuple.
2023-09-09Fixed #34820 -- Fixed migrations crash when changing a ForeignObject field.donghao
2023-09-07Fixed #31300 -- Added GeneratedField model field.Jeremy Nauta
Thanks Adam Johnson and Paolo Melchiorre for reviews. Co-Authored-By: Lily Foote <code@lilyf.org> Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2023-08-30 Fixed #31262 -- Added support for mappings on model fields and ↵Nick Pope
ChoiceField's choices.
2023-08-23Fixed #34744 -- Prevented recreation of migration for constraints with a ↵David Sanders
dict_keys. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2023-08-04Fixed #34760 -- Dropped support for SQLite < 3.27.Mariusz Felisiak
2023-07-22Refs #24686 -- Made AlterField operation a noop when renaming related model ↵devilsautumn
with db_table.
2023-07-18Refs #33201 -- Avoided unnecessary queries when renaming models with ↵Mariusz Felisiak
db_table on SpatiaLite.
2023-07-18Fixed #34716 -- Fixed serialization of nested class methods in migrations.Nicolò Intrieri
Co-authored-by: Nicolò <nicolo.intrieri@spinforward.it>
2023-07-12Fixed #34697 -- Fixed non-deterministic order of dependencies and ↵Yury V. Zaytsev
sets/frozensets in migrations. Co-authored-by: Dakota Hawkins <dakotahawkins@gmail.com>
2023-06-28Fixed RecorderTests.test_has_table_cached() on databases that perform ↵Mariusz Felisiak
multiple queries when introspecting tables. Thanks Tim Graham for the report and implementation idea. Follow up to ea8cbca579cc6742e119747fc1eb6ecf90638bce.
2023-05-25Made MigrationRecorder cache has_table() result if django_migrations table ↵Tom Forbes
exists.
2023-05-17Fixed #34568 -- Made makemigrations --update respect --name option.Mariusz Felisiak
Thanks David Sanders for the report.
2023-05-12Fixed #470 -- Added support for database defaults on fields.Ian Foote
Special thanks to Hannes Ljungberg for finding multiple implementation gaps. Thanks also to Simon Charette, Adam Johnson, and Mariusz Felisiak for reviews.
2023-05-10Fixed #34553 -- Fixed improper % escaping of literal in constraints.Simon Charette
Proper escaping of % in string literals used when defining constaints was attempted (a8b3f96f6) by overriding quote_value of Postgres and Oracle schema editor. The same approach was used when adding support for constraints to the MySQL/MariaDB backend (1fc2c70). Later on it was discovered that this approach was not appropriate and that a preferable one was to pass params=None when executing the constraint creation DDL to avoid any form of interpolation in the first place (42e8cf47). When the second patch was applied the corrective of the first were not removed which caused % literals to be unnecessary doubled. This flew under the radar because the existings test were crafted in a way that consecutive %% didn't catch regressions. This commit introduces an extra test for __exact lookups which highlights more adequately % doubling problems but also adjust a previous __endswith test to cover % doubling problems (%\% -> %%\%%). Thanks Thomas Kolar for the report. Refs #32369, #30408, #30593.