Mariusz Felisiak
3278c31fa5
[4.0.x] Refs #33476 -- Refactored code to strictly match 88 characters line length.
...
Backport of 7119f40c98
from main.
2022-02-08 19:25:02 +01:00
django-bot
6a682b38e7
[4.0.x] Refs #33476 -- Reformatted code with Black.
...
Backport of 9c19aff7c7
from main.
2022-02-08 12:15:38 +01:00
Mariusz Felisiak
7c2d4d943b
[4.0.x] Fixed #33462 -- Fixed migration crash when altering type of primary key with MTI and foreign key.
...
This prevents duplicated operations when altering type of primary key
with MTI and foreign key. Previously, a foreign key to the base model
was added twice, once directly and once by the inheritance model.
Thanks bcail for the report.
Regression in 325d7710ce
.
Backport of e972620ada
from main
2022-01-27 18:52:35 +01:00
Hannes Ljungberg
00aa3e0b9b
[4.0.x] Fixed #33194 -- Fixed migrations when altering a field with functional indexes/unique constraints on SQLite.
...
This adjusts Expressions.rename_table_references() to only update alias
when needed.
Regression in 83fcfc9ec8
.
Co-authored-by: Simon Charette <charettes@users.noreply.github.com>
Backport of 86971c4090
from main
2021-10-18 09:36:21 +02:00
Mariusz Felisiak
1eb3f500a4
Fixed #33057 -- Fixed recreation of foreign key constraints in m2m tables when altering type of referenced primary key on Oracle.
2021-08-31 13:43:10 +02:00
Jordan Bae
3d9040a50b
Refs #32743 -- Fixed recreation of foreign key constraints when altering type of referenced primary key with MTI.
...
Follow up to 325d7710ce
.
2021-07-27 07:30:33 +02:00
David Wobrock
325d7710ce
Fixed #32743 -- Added foreign key altering when altering type of referenced primary key with MTI.
2021-07-26 08:51:56 +02:00
Hannes Ljungberg
3e0fdf5546
Fixed #32780 -- Made Add/RemoveConstraint operations a noop for covering/deferrable unique constraints on SQLite.
2021-05-25 11:34:25 +02:00
Hannes Ljungberg
eab71f7690
Fixed #32686 -- Removed unnecessary semicolon on collected multiline SQL for RunSQL.
2021-04-27 08:01:07 +02:00
Hannes Ljungberg
95754dbc9b
Refs #32686 -- Added tests for adding a semicolon when collecting SQL for RunSQL.
2021-04-27 07:59:41 +02:00
Hannes Ljungberg
3aa545281e
Fixed #30916 -- Added support for functional unique constraints.
...
Thanks Ian Foote and Mariusz Felisiak for reviews.
2021-02-23 20:19:53 +01:00
Hannes Ljungberg
87acbf0631
Fixed #32458 -- Made __repr__() for Index and BaseConstraint subclasses more consistent.
2021-02-19 20:25:11 +01:00
Simon Charette
42e8cf47c7
Fixed #32369 -- Fixed adding check constraints with pattern lookups and expressions as rhs.
...
This disables interpolation of constraint creation statements. Since
Constraint.create_sql interpolates its parameters instead of deferring
this responsibility to the backend connection it must disable
connection level parameters interpolation.
2021-01-26 06:41:57 +01:00
Hannes Ljungberg
83fcfc9ec8
Fixed #26167 -- Added support for functional indexes.
...
Thanks Simon Charette, Mads Jensen, and Mariusz Felisiak for reviews.
Co-authored-by: Markus Holtermann <info@markusholtermann.eu>
2021-01-13 11:47:50 +01:00
Tim Graham
84ca7b8602
Removed hardcoded pks in migrations' test_alter_order_with_respect_to.
2020-11-07 20:26:01 +01:00
Mariusz Felisiak
e6b5108acc
Fixed #27417 -- Made RenameField operation a noop for field name case changes on Oracle.
...
Field names are always uppercased in the Oracle backend. Changing case
should be a noop to avoid database errors: "ORA-00957: duplicate column
name".
2020-09-04 20:27:23 +02:00
Iuri de Silvio
632ccffc49
Fixed #31826 -- Made AlterField operation a noop when adding db_column.
...
AlterField operation with adding a db_column is a noop if the column
name is not changed.
2020-08-14 13:13:36 +02:00
Iuri de Silvio
7f4c9222df
Fixed #31825 -- Made RenameField operation a noop for fields with db_column.
2020-08-13 13:14:58 +02:00
Hannes Ljungberg
8c7992f658
Fixed #30913 -- Added support for covering indexes on PostgreSQL 11+.
2020-06-04 12:26:22 +02:00
Adam Johnson
fa58450a9a
Fixed #31468 -- Allowed specifying migration filename in Operation.
...
This adds also suggested filename for many built-in operations.
2020-05-28 11:42:53 +02:00
Ian Foote
c226c6cb32
Fixed #20581 -- Added support for deferrable unique constraints.
2020-04-30 10:43:50 +02:00
David Wobrock
533b208775
Fixed #29224 -- Fixed removing index_together indexes if exists unique_together constraint on the same fields.
2020-04-23 12:28:51 +02:00
Simon Charette
06889d6206
Fixed #31499 -- Stored ModelState.fields into a dict.
...
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 07:10:00 +02:00
Simon Charette
5220ca8d8a
Refs #30591 -- Adjusted table rebuild for non-pk relationship on SQLite.
...
The existing code was only accounting for primary key changes and not
all unique key fields that can be referenced.
2020-04-21 08:37:47 +02:00
Simon Charette
a548280857
Fixed #31064 -- Recreated auto-created many-to-many tables on primary key data type change on SQLite.
...
Both local and remote auto-created many-to-many relationships were
affected.
2020-04-21 08:37:40 +02:00
Simon Charette
2ba55b2905
Removed redundant import in tests/migrations/test_operations.py.
2020-04-21 08:37:37 +02:00
Simon Charette
8069526ce3
Made Operation.references_model/references_field require app_label.
...
This will allow them to drop a ton of logic to deal with null
app_label.
2020-04-09 10:08:06 +02:00
Nick Pope
335c9c94ac
Simplified imports from django.db and django.contrib.gis.db.
2020-02-04 13:20:06 +01:00
Mariusz Felisiak
b423873cb7
Refs #31197 -- Added tests for combined expressions in CheckConstraint.check.
...
Thanks Adam Johnson for the report.
Fixed in 306b687520
.
2020-01-23 10:28:36 +01:00
Mariusz Felisiak
937ddaff55
Refs #30591 -- Fixed too long identifier crash in migrations.test_operations on MySQL 8.0.16+.
2019-09-11 12:20:16 +02:00
Adnan Umer
241deed259
Fixed #30591 -- Fixed recreation of foreign key constraints on MySQL when altering type of referenced unique field.
...
Thanks Mariusz Felisiak for tests and Matthijs Kooijman for
investigation and initial patch.
2019-09-11 11:21:08 +02:00
Mads Jensen
b10d322c41
Moved migrations.test_operations.OperationTestBase to migrations.test_base.
...
Co-Authored-By: Daniel Tao <daniel.tao@gmail.com>
2019-08-19 16:06:14 +02:00
Nick Pope
194d1dfc18
Fixed #30661 -- Added models.SmallAutoField.
2019-08-02 11:39:01 +02:00
can
719b746620
Fixed #30412 -- Fixed crash when adding check constraints with OR'ed condition on Oracle and SQLite.
2019-04-30 12:32:27 +02:00
Simon Charette
a8b3f96f6a
Fixed #30408 -- Fixed crash when adding check constraints with LIKE operator on Oracle and PostgreSQL.
...
The LIKE operator wildcard generated for contains, startswith, endswith and
their case-insensitive variant lookups was conflicting with parameter
interpolation on CREATE constraint statement execution.
Ideally we'd delegate parameters interpolation in DDL statements on backends
that support it but that would require backward incompatible changes to the
Index and Constraint SQL generating methods.
Thanks David Sanders for the report.
2019-04-30 07:38:22 +02:00
Paveł Tyślacki
62b8596616
Made test table cleanup in OperationTestBase more robust.
...
Some non-unique constraint names were added in
b69f8eb04c
which resulted in failures
depending on the order in which tests were run.
2019-01-28 11:51:23 -05:00
Paveł Tyślacki
b69f8eb04c
Fixed #30062 -- Added support for unique conditional constraints.
2019-01-12 09:50:20 -05:00
Tim Graham
f82be9ebc7
Fixed #29934 -- Added sqlparse as a require dependency.
2018-11-09 19:09:36 -05:00
Simon Charette
630f3d8b46
Refs #29868 -- Prevented name collisions between test constraints on Oracle.
2018-10-30 09:26:03 -04:00
Simon Charette
95bda03f2d
Fixed #29868 -- Retained database constraints on SQLite table rebuilds.
...
Refs #11964 .
Thanks Scott Stevens for testing this upcoming feature and the report.
2018-10-29 10:33:41 +01:00
Simon Charette
32da3cfdf9
Refs #11964 -- Removed raw SQL from and cleaned up constraint operation tests.
2018-10-24 19:18:41 -04:00
Simon Charette
9142bebff2
Refs #11964 -- Changed CheckConstraint() signature to use keyword-only arguments.
...
Also renamed the `constraint` argument to `check` to better represent which
part of the constraint the provided `Q` object represents.
2018-10-02 10:53:04 -04:00
Simon Charette
dc1dcad0f5
Refs #24424 -- Added regression tests for MTI-inheritance model removal.
...
The issue was fixed as a side effect of implementing RemoveField's reduction
of DeleteModel to a DeleteModel in ad82900ad9
.
2018-07-25 12:07:41 -04:00
Simon Charette
0025dd5eb4
Allowed RemoveField operations to be optimized through.
2018-07-11 10:49:50 -04:00
Simon Charette
50b8c98a0f
Relaxed FieldOperation.references_field remote field checking.
2018-07-11 10:49:50 -04:00
Ian Foote
952f05a6db
Fixed #11964 -- Added support for database check constraints.
2018-07-10 15:32:33 -04:00
Jeff
fcc4e251db
Fixed #29000 -- Fixed RenameModel's renaming of a M2M column when run after RenameField.
...
Regression in 45ded053b1
.
2018-06-15 11:51:09 -04:00
Simon Charette
dcdd219ee1
Fixed #25817 -- Made RenameField repoint to_field/to_fields references.
...
Also updated the autodetector to assume the RenameField operation will
perform the required repointing.
2017-12-30 14:59:22 -05:00
Mariusz Felisiak
83a36ac49a
Removed unnecessary trailing commas and spaces in various code.
2017-12-28 21:07:29 +01:00
Simon Charette
9f7772e098
Fixed #28884 -- Fixed crash on SQLite when renaming a field in a model referenced by a ManyToManyField.
...
Introspected database constraints instead of relying on _meta.related_objects
to determine whether or not a table or a column is referenced on rename
operations.
This has the side effect of ignoring both db_constraint=False and virtual
fields such as GenericRelation which aren't backend by database level
constraints and thus shouldn't prevent the rename operations from being
performed in a transaction.
Regression in 095c1aaa89
.
Thanks Tim for the additional tests and edits, and Mariusz for the review.
2017-12-22 15:19:05 -05:00