Commit Graph

223 Commits

Author SHA1 Message Date
Mariusz Felisiak 338fc0e7f1 Fixed #33080 -- Preserved nullability of textual fields on Oracle.
Thanks Matt Hoskins for the report.
2021-09-01 20:54:12 +02:00
Mariusz Felisiak f65eb46646 Fixed typo in tests/schema/tests.py docstrings. 2021-09-01 20:54:12 +02:00
David Smith 1cba320786
Refs #32956 -- Changed "afterwards" to "afterward" in docs and comments.
This also removes unnecessary comments with the previous spelling.

AP Stylebook has a short entry to advise the preferred spelling for
"en-us". "Afterwards" is preferred in British English.
2021-07-27 10:41:51 +02:00
Daniyal f479df7f8d Refs #32508 -- Raised Type/ValueError instead of using "assert" in django.db.models.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-07-15 11:43:33 +02:00
Mariusz Felisiak fa0433d05f Fixed #32832 -- Fixed adding BLOB/TEXT nullable field with default on MySQL 8.0.13+.
Regression in d4ac23bee1.

Thanks Omkar Deshpande for the report.
2021-06-10 20:03:43 +02:00
David Wobrock b9df2b74b9 Fixed #32676 -- Prevented migrations from rendering related field attributes when not passed during initialization.
Thanks Simon Charette for the implementation idea.
2021-05-28 20:25:59 +02:00
Hannes Ljungberg b746596f5f Refs #32779 -- Changed DatabaseSchemaEditor._unique_sql()/_create_unique_sql() to take fields as second parameter. 2021-05-28 10:50:27 +02:00
Hannes Ljungberg 7ef2398e81 Fixed #32777 -- Passed table reference as a string to DatabaseSchemaEditor._index_columns(). 2021-05-24 06:31:48 +02:00
Yuekui Li 5e04e84d67 Fixed #32503 -- Fixed altering BLOB/TEXT field to non-nullable with default on MySQL 8.0.13+.
MySQL 8.0.13+ supports defaults for BLOB/TEXT but not in the
ALTER COLUMN statement.

Regression in 6b16c91157.

Thanks Matt Westcott for the report.
2021-05-21 13:34:37 +02:00
Mariusz Felisiak af609c2f4d
Fixed isolation of test_rename_table_renames_deferred_sql_references(). 2021-04-26 06:11:13 +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
Jordan Bae d4ac23bee1 Fixed #32425 -- Fixed adding nullable field with default on MySQL.
Thanks Simon Charette for the review.
2021-02-09 06:59:31 +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
Hasan Ramezani 275dd4ebba
Fixed #32178 -- Allowed database backends to skip tests and mark expected failures.
Co-authored-by: Tim Graham <timograham@gmail.com>
2020-12-10 18:00:57 +01:00
Tim Graham 8ed024b9b9
Refs #32120 -- Fixed test_add_inline_fk_index_update_data for DatabaseFeatures.indexes_foreign_keys.
This test creates an index with editor.add_index() so it's present
regardless of the database's behavior. Reverted the change from
ede9fac758.
2020-11-13 06:17:13 +01:00
Martin Thoma 302caa40e4 Made small readability improvements. 2020-10-28 20:20:20 +01:00
Tim Graham ede9fac758
Fixed #32120 -- Added DatabaseFeatures.indexes_foreign_keys. 2020-10-20 06:22:56 +02:00
Çağıl Uluşahin 9159d173c3 Fixed #25253 -- Made AlterField operation a noop when changing attributes that don't affect the schema. 2020-10-15 20:11:07 +02:00
Mariusz Felisiak 999cddd58d
Fixed #32073 -- Skipped collation tests on PostgreSQL < 10.
PostgreSQL < 10 doesn't support ICU collations.

Thanks Hannes Ljungberg for the report.
2020-10-06 12:51:35 +02:00
Tom Carrick e387f191f7 Fixed #31777 -- Added support for database collations to Char/TextFields.
Thanks Simon Charette and Mariusz Felisiak for reviews.
2020-09-21 18:24:56 +02:00
Tim Graham ea880ec233 Fixed #24533 -- Dropped PostgreSQL sequence and Oracle identity when migrating away from AutoField. 2020-08-24 14:32:07 +02:00
Tim Graham 7ca42974ee
Added assertions for the results of migrating an integer pk to AutoField. 2020-08-24 06:45:48 +02:00
Ahmad A. Hussein 493b26bbfc Fixed #31888 -- Avoided module-level MySQL queries in tests. 2020-08-17 09:31:16 +02:00
Mariusz Felisiak fd53db842c
Fixed #31805 -- Fixed SchemaTests.tearDown() when table names are case-insensitive. 2020-07-22 12:49:56 +02:00
Mariusz Felisiak c071c408d7
Fixed #31797 -- Skipped schema tests on specific MariaDB versions.
test_alter_not_unique_field_to_primary_key() test is affected by
https://jira.mariadb.org/browse/MDEV-19598 on MariaDB 10.4.4 to 10.5.1.

test_alter_pk_with_self_referential_field() test is affected by
https://jira.mariadb.org/browse/MDEV-22775 on MariaDB 10.4 series
from 10.4.13.
2020-07-22 10:57:38 +02:00
Simon Charette 2e8941b6f9 Fixed #31735 -- Fixed migrations crash on namespaced inline FK addition on PostgreSQL.
The namespace of the constraint must be included when making the
constraint immediate.

Regression in 22ce5d0031.

Thanks Rodrigo Estevao for the report.
2020-06-24 08:37:20 +02:00
Hannes Ljungberg 8c7992f658 Fixed #30913 -- Added support for covering indexes on PostgreSQL 11+. 2020-06-04 12:26:22 +02:00
Tim Graham a7b4a04d6c Refs #31630 -- Added CharField and IntegerField to DatabaseFeatures.introspected_field_types.
CockroachDB introspects CharField as TextField and IntegerField as
BigIntegerField.
2020-06-04 08:46:06 +02:00
Hasan Ramezani e198beadad Fixed #31630 -- Replaced introspection features with DatabaseFeatures.introspected_field_types. 2020-06-04 08:27:42 +02:00
Tim Graham e21788121b
Added missing Meta.apps to a schema model. 2020-03-23 06:09:10 +01:00
Jon Dufresne f02c1fcf4c
Corrected typo in test docstring. 2020-02-20 09:12:09 +01:00
Nick Pope 335c9c94ac Simplified imports from django.db and django.contrib.gis.db. 2020-02-04 13:20:06 +01:00
Mariusz Felisiak 22ce5d0031
Fixed #31106 -- Fixed migrations crash on PostgreSQL 10+ when adding FK constraints inline and changing data.
This allows adding foreign key constraints inline and changing data in
the same migration on PostgreSQL 10+.

Regression in 738faf9da2.

Thanks Janne Rönkkö for the report and Simon Charette for the
implementation idea and review.
2019-12-23 23:28:59 +01:00
Nick Pope 7552de7866 Used more specific unittest assertions in tests.
* assertIsNone()/assertIsNotNone() instead of comparing to None.
* assertLess() for < comparisons.
* assertIs() for 'is' expressions.
* assertIsInstance() for isinstance() expressions.
* rounding of assertAlmostEqual() for round() expressions.
* assertIs(..., True/False) instead of comparing to True/False.
* assertIs()/assertIsNot() for ==/!= comparisons.
* assertNotEqual() for == comparisons.
* assertTrue()/assertFalse() instead of comparing to True/False.
2019-10-29 12:37:30 +01:00
Hasan Ramezani ef4beafa2c Refs #28816 -- Prevented silencing data loss when decreasing CharField.max_length for ArrayField.base_field on PostgreSQL. 2019-10-17 12:50:53 +02:00
Mariusz Felisiak 580e644f24
Fixed #30800 -- Fixed migrations crash when altering a field with custom db_type().
Regression in 1378d665a1.
2019-09-25 12:32:24 +02:00
Mariusz Felisiak c8250ef361
Refs #27338 -- Added tests for altering CharField with primary_key=True to AutoField on PostgreSQL.
Fixed in 91b2bc3e70.
2019-09-11 13:40:49 +02:00
Hasan Ramezani b93d786251 Made SchemaTests.test_alter_db_table_case run only on backends where table names are case-insensitive. 2019-09-05 08:59:48 +02:00
Min ho Kim 7bd9633320 Fixed typos in test names and a comment. 2019-08-23 10:46:43 +02:00
Nick Pope 194d1dfc18 Fixed #30661 -- Added models.SmallAutoField. 2019-08-02 11:39:01 +02:00
Mariusz Felisiak ff111ea5e3 Refs #30664 -- Fixed migrations crash when altering AutoField/BigAutoField with quoted db_column on PostgreSQL. 2019-08-01 12:06:32 +02:00
Ngalim Siregar e4684220af Fixed #30664 -- Fixed migrations crash when altering table on SQLite or altering AutoField/BigAutoField on PostgreSQL for models with quoted db_table. 2019-08-01 12:06:32 +02:00
Hasan Ramezani 1fc2c70f76 Fixed #30593 -- Added support for check constraints on MariaDB 10.2+. 2019-07-19 11:05:06 +02:00
Mariusz Felisiak 8233144ca0 Changed django.db.models.indexes.Index imports to django.db.models.Index. 2019-07-08 14:19:46 +02:00
Hasan Ramezani 1378d665a1 Fixed #28816 -- Prevented silencing data loss when decreasing CharField.max_length on PostgreSQL. 2019-05-21 14:15:43 +02:00
Dolan Antenucci f944cb3d3b
Fixed #30266 -- Kept a sequence owner when altering an AutoField/BigAutoField on PostgreSQL. 2019-04-08 22:24:18 +02:00
Paveł Tyślacki 5c17c273ae Refs #30172 -- Prevented removing a model Meta's index/unique_together from removing Meta constraints/indexes. 2019-03-17 20:50:57 -04:00
Paveł Tyślacki 4bb859e246 Refs #30172 -- Prevented removing a field's check or unique constraint from removing Meta constraints. 2019-03-17 20:50:22 -04:00
Paveł Tyślacki 782d85b6df Fixed #30183 -- Added introspection of inline SQLite constraints. 2019-03-13 10:24:28 -04:00
Dan Tao 738faf9da2 Fixed #30108 -- Allowed adding foreign key constraints in the same statement that adds a field. 2019-01-29 15:42:57 -05:00