summaryrefslogtreecommitdiff
path: root/tests/schema
AgeCommit message (Collapse)Author
2026-01-31Added supports_expression_indexes skip to nulls_distinct test.Tim Graham
2025-12-30Refs #21961 -- Added supports_on_delete_db_cascade skips in schema tests.Tim Graham
2025-12-16Fixed #36800 -- Restored ManyToManyField renaming in ↵Clifford Gama
BaseDatabaseSchemaEditor.alter_field(). Regression in f9a44cc0fac653f8e0c2ab1cdfb12b2cc5c63fc2. Now that ManyToManyField is no longer concrete the decision of whether or not it should be altered, which is also relied on by field renaming, should take into consideration name changes even if it doesn't have a column associated with it, as auto-created many-to-many relationship table names are a base of it. Note that there is room for optimization here where a rename can be entirely avoided if ManyToManyField.db_table remains stable between .name changes, just like we do with Field.db_column remaining stable, but since this is a regression and meant to be backported the current patch focuses on correctness over further improvements. Thanks Josik for the report. Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-12-13Fixed #36765 -- Added support for stored GeneratedFields on Oracle 23ai/26ai ↵Mariusz Felisiak
(23.7+). Thanks Jacob Walls for the review.
2025-10-18Fixed #21961 -- Added support for database-level delete options for ForeignKey.Mariusz Felisiak
Thanks Simon Charette for pair programming. Co-authored-by: Nick Stefan <NickStefan12@gmail.com> Co-authored-by: Akash Kumar Sen <71623442+Akash-Kumar-Sen@users.noreply.github.com> Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-09-05Fixed #36564 -- Changed DEFAULT_AUTO_FIELD from AutoField to BigAutoField.Tim Graham
2025-07-23Refs #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-04-05Fixed #36156 -- Added supports_json_field check in ↵Kelvin Adigwu
test_db_default_output_field_resolving test.
2025-02-22Fixed #35839 -- Fixed crash when adding GeneratedField with db_comment on MySQL.saJaeHyukc
Thanks Simon Charette for the test. Signed-off-by: saJaeHyukc <wogur981208@gmail.com>
2025-02-18Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.Mariusz Felisiak
datetime.UTC was added in Python 3.11.
2024-10-31Fixed #35180 -- Recreated PostgreSQL _like indexes when changing between ↵Ben Cail
TextField and CharField field types.
2024-09-03Added assertion for the results of migrating an integer pk to SmallAutoField.Tim Graham
Follow up to 7ca42974ee087a82b6f7f6874ca2b25e42a9a584 which did the same for similar tests.
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-04-16Fixed #35373 -- Fixed a crash when indexing a generated field on SQLite.Simon Charette
Generated fields have to be excluded from the INSERT query against the remade table including the index. Thanks Moshe Dicker for the report, David Sanders and Mariusz Felisiak for the review.
2024-04-12Refs #35194 -- Adjusted a generated field test to work on Postgres 15.6+.Simon Charette
Postgres >= 12.18, 13.14, 14.11, 15.6, 16.2 changed the way the immutability of generated and default expressions is detected in postgres/postgres@743ddaf. The adjusted test semantic is presereved by switching from __icontains to __contains as both make use of a `%` literal which requires proper escaping. Refs #35336. Thanks bcail for the report.
2024-04-02Fixed #35336 -- Addressed crash when adding a GeneratedField with % literals.Simon Charette
A longer term solution is likely to have a better separation of parametrized DDL altogether to handle checks, constraints, defaults, and generated fields but such a change would require a significant refactor that isn't suitable for a backport. Thanks Adrian Garcia for the report.
2024-03-26Fixed #35329 -- Fixed migrations crash when adding partial unique ↵Mariusz Felisiak
constraints with nulls_distinct. Bug in 595a2abb58e04caa4d55fb2589bb80fb2a8fdfa1. Thanks Lucas Lemke Saunitti for the report.
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-15Fixed #34060 -- Fixed migrations crash when adding check constraints with ↵Albert Defler
JSONField __exact lookup on Oracle.
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-02-04Refs #35149 -- Made equivalent db_default alterations noops.Simon Charette
This allows for an easier transition of preserving the literal nature of non-compilable db_default.
2024-02-03Fixed #35162 -- Fixed crash when adding fields with db_default on MySQL.Simon Charette
MySQL doesn't allow literal DEFAULT values to be used for BLOB, TEXT, GEOMETRY or JSON columns and requires expression to be used instead. Regression in 7414704e88d73dafbcfbb85f9bc54cb6111439d3.
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2023-12-14Refs #32503 -- Added assertion for effective default value when altering ↵Tobias Krönke
TextField to non-nullable with default.
2023-12-12Fixed #35018 -- Fixed migrations crash on GeneratedField with BooleanField ↵Mariusz Felisiak
as output_field on Oracle < 23c. Thanks Václav Řehák for the report. Regression in f333e3513e8bdf5ffeb6eeb63021c230082e6f95.
2023-12-03Fixed #35002 -- Made UniqueConstraints with fields respect nulls_distinct.Peter Thomassen
Regression in 595a2abb58e04caa4d55fb2589bb80fb2a8fdfa1.
2023-11-30Fixed #35006 -- Fixed migrations crash when altering Meta.db_table_comment ↵Mariusz Felisiak
on SQLite. Thanks Юрий for the report. Regression in 78f163a4fb3937aca2e71786fbdd51a0ef39629e.
2023-11-14Fixed #34944 -- Made GeneratedField.output_field required.Mariusz Felisiak
Regression in f333e3513e8bdf5ffeb6eeb63021c230082e6f95.
2023-11-14Reverted "Refs #30446, Refs #34944 -- Fixed crash when adding GeneratedField ↵Mariusz Felisiak
with string Value()." This reverts commit 8b1acc0440418ac8f45ba48e2dfcf5126c83341b.
2023-11-08Refs #30446, Refs #34944 -- Fixed crash when adding GeneratedField with ↵Simon Charette
string Value(). This should allow smarter output_field inferring in functions dealing with text expressions. Regression in f333e3513e8bdf5ffeb6eeb63021c230082e6f95.
2023-11-07Fixed #34946 -- Preserved db_default on combined default field addition.Simon Charette
Regression in 7414704e88d73dafbcfbb85f9bc54cb6111439d3.
2023-10-30Fixed #34932 -- Restored varchar_pattern_ops/text_pattern_ops index creation ↵Tom Carrick
when deterministic collaction is set. Regression in f3f9d03edf17ccfa17263c7efa0b1350d1ac9278 (4.2) and 8ed25d65ea7546fafd808086fa07e7e5bb5428fc (5.0).
2023-09-28Fixed #34877 -- Fixed migrations crash when adding GeneratedField with ↵Paolo Melchiorre
output_field with params.
2023-09-22Fixed #34861 -- Fixed crash when adding GeneratedField with some expressions.Paolo Melchiorre
Co-authored-by: Simon Charette <charette.s@gmail.com>
2023-09-18Refs #27236 -- Removed Meta.index_together per deprecation timeline.Mariusz Felisiak
2023-08-04Fixed #34760 -- Dropped support for SQLite < 3.27.Mariusz Felisiak
2023-07-30Fixed warnings per flake8 6.1.0.Mariusz Felisiak
2023-07-19Fixed #34701 -- Added support for NULLS [NOT] DISTINCT on PostgreSQL 15+.Simon Charette
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-04-21Fixed #34505 -- Skipped varchar_pattern_ops/text_pattern_ops index creation ↵Petter Friberg
when db_collation is set in related field.
2023-04-21Added SchemaTests._add_ci_collation() hook.Mariusz Felisiak
2023-02-24Refs #34320 -- Added skipIf for a test requiring check constraints.Tim Graham
2023-02-15Fixed #34320 -- Make sure constraints names are obtained from truncated ↵nabil-rady
columns names.
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0
2023-01-31Fixed #34304 -- Made MySQL's SchemaEditor.remove_constraint() don't create ↵sag᠎e
foreign key index when unique constraint is ignored. Regression in b731e8841558ee4caaba766c83f34ea9c7004f8b.
2022-12-28Fixed #18468 -- Added support for comments on columns and tables.kimsoungryoul
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>
2022-12-22Fixed #34219 -- Preserved Char/TextField.db_collation when altering column type.Mariusz Felisiak
This moves setting a database collation to the column type alteration as both must be set at the same time. This should also avoid another layer of the column type alteration when adding database comments support (#18468).
2022-12-15Fixed #33308 -- Added support for psycopg version 3.Daniele Varrazzo
Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews. Co-authored-by: Florian Apolloner <florian@apolloner.eu> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-11-04Fixed #34138 -- Avoided table rebuild when adding inline m2m fields on SQLite.Mariusz Felisiak
Regression in 2f73e5406d54cb8945e187eff302a3a3373350be. Thanks David Wobrock for the report.