Commit Graph

89 Commits

Author SHA1 Message Date
Adam Johnson 7646b9023d
Fixed #35301 -- Fixed Options._property_names for overriden properties.
Regression in faeb92ea13.
2024-03-17 09:43:04 +01:00
Simon Charette daf7d482db Refs #35234 -- Deprecated CheckConstraint.check in favor of .condition.
Once the deprecation period ends CheckConstraint.check() can become the
documented method that performs system checks for BaseConstraint
subclasses.
2024-03-01 07:15:32 +01:00
Simon Charette abe6c1f93e Refs #30913 -- Corrected IndexesTests.test_index_include_pointing_to_fk().
This adjusts a test assigning an Index to Meta.constraints.
2024-02-21 08:25:41 +01:00
Mariusz Felisiak 305757aec1
Applied Black's 2024 stable style.
https://github.com/psf/black/releases/tag/24.1.0
2024-01-26 12:45:07 +01:00
Mariusz Felisiak 2abf417c81 Refs #27236 -- Removed Meta.index_together per deprecation timeline. 2023-09-18 22:12:40 +02:00
Simon Charette 595a2abb58 Fixed #34701 -- Added support for NULLS [NOT] DISTINCT on PostgreSQL 15+. 2023-07-19 21:42:27 +02:00
Akash Kumar Sen 82a588a6bc Fixed #34634 -- Adjusted system check for clashing fields to warn about links to common parent for MTI models. 2023-06-20 08:10:53 +02:00
David Smith 097e3a70c1 Refs #33476 -- Applied Black's 2023 stable style.
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-02-01 11:04:38 +01:00
kimsoungryoul 78f163a4fb Fixed #18468 -- Added support for comments on columns and tables.
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-28 06:28:07 +01:00
David Wobrock a6385b382e
Fixed #27236 -- Deprecated Meta.index_together in favor of Meta.indexes.
This also deprecates AlterIndexTogether migration operation.
2022-07-12 09:04:31 +02:00
Gagaro 667105877e Fixed #30581 -- Added support for Meta.constraints validation.
Thanks Simon Charette, Keryn Knight, and Mariusz Felisiak for reviews.
2022-05-10 11:22:23 +02:00
Mariusz Felisiak 7119f40c98 Refs #33476 -- Refactored code to strictly match 88 characters line length. 2022-02-07 20:37:05 +01:00
django-bot 9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Mariusz Felisiak c5cd878382
Refs #33476 -- Refactored problematic code before reformatting by Black.
In these cases Black produces unexpected results, e.g.

def make_random_password(
    self,
    length=10,
    allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789',
):

or

cursor.execute("""
SELECT ...
""",
    [table name],
)
2022-02-03 11:20:46 +01:00
Tom Wojcik 20226fcd46 Fixed #32947 -- Fixed hash() crash on reverse M2M relation when through_fields is a list.
Regression in c32d8f33d8.
2021-07-26 06:09:29 +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
Carlton Gibson 225d96533a Fixed #30427, Fixed #16176 -- Corrected setting descriptor in Field.contribute_to_class().
Co-authored-by: Jarek Glowacki <jarekwg@gmail.com>
2021-06-15 12:01:28 +02:00
Hasan Ramezani a77c9a4229 Fixed #32635 -- Fixed system check crash for reverse o2o relations in CheckConstraint.check and UniqueConstraint.condition.
Regression in b7b7df5fbc.

Thanks Szymon Zmilczak for the report.
2021-04-14 10:06:18 +02:00
Hasan Ramezani 33abc55601 Refs #31530 -- Added test for joined OneToOneField in CheckConstraint.check 2021-04-14 09:37:55 +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
Hasan Ramezani f750377318 Fixed #32321 -- Added system checks for invalid model field names in functional indexes. 2021-01-14 12:27:00 +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 b7b7df5fbc Fixed #31530 -- Added system checks for invalid model field names in CheckConstraint.check and UniqueConstraint.condition. 2020-07-06 09:16:57 +02:00
Mariusz Felisiak f83b44075d Refs #30913 -- Added system checks for covering indexes and unique constraints support. 2020-06-04 12:26:25 +02:00
Hannes Ljungberg 8c7992f658 Fixed #30913 -- Added support for covering indexes on PostgreSQL 11+. 2020-06-04 12:26:22 +02:00
Hasan Ramezani 3c7bf39e23 Fixed #31410 -- Added system checks for invalid model field names in UniqueConstraint. 2020-05-20 10:56:55 +02:00
sage 6789ded0a6 Fixed #12990, Refs #27694 -- Added JSONField model field.
Thanks to Adam Johnson, Carlton Gibson, Mariusz Felisiak, and Raphael
Michel for mentoring this Google Summer of Code 2019 project and
everyone else who helped with the patch.

Special thanks to Mads Jensen, Nick Pope, and Simon Charette for
extensive reviews.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-05-08 07:23:31 +02:00
Mariusz Felisiak b73e66e758
Fixed #31538 -- Fixed Meta.ordering validation lookups that are not transforms.
Regression in 440505cb2c.

Thanks Simon Meers for the report.
2020-05-05 09:08:29 +02:00
Ian Foote c226c6cb32 Fixed #20581 -- Added support for deferrable unique constraints. 2020-04-30 10:43:50 +02:00
Ichlasul Affan 53d229ff63 Fixed #31351 -- Added system checks for partial indexes and unique constraints support. 2020-04-10 12:00:27 +02:00
Mariusz Felisiak e8d3088925 Refs #31055 -- Allowed database queries in invalid_models_tests.test_models.FieldNamesTests. 2020-04-10 11:54:14 +02:00
Mariusz Felisiak 3f7e4b16bf Removed redundant get_max_column_name_length() calls in invalid_models_tests.test_models.FieldNamesTests. 2020-03-18 18:41:40 +01:00
Mariusz Felisiak 5c8441a0b8 Refs #31055 -- Made long column names checks support databases aware. 2020-03-18 18:41:40 +01:00
Xavier Francisco 8690878507 Fixed #31277 -- Relaxed system check of m2m intermediary tables for db_table collision when database routers are installed.
Turned the error into a warning when database routers are installed.
2020-02-17 13:53:45 +01:00
Mariusz Felisiak 708c534e0b Refs #31055 -- Fixed Model.check() call in ConstraintsTests.test_check_constraints_required_db_features(). 2020-02-08 17:23:35 +01:00
Simon Charette 71756bdfed Fixed #31055 -- Made constraint checks support databases aware. 2020-02-07 11:03:53 +01:00
Mariusz Felisiak bf77669453
Fixed #29998 -- Allowed multiple OneToOneFields to the parent model.
We assumed that any OneToOneField's in a child model must be the
parent link and raised an error when parent_link=True was not
specified. This patch allows to specify multiple OneToOneField's to
the parent model.

OneToOneField's without a custom related_name will raise fields.E304
and fields.E305 so this should warn users when they try to override
the auto-created OneToOneField.
2020-01-16 08:06:16 +01:00
Hasan Ramezani 95a11578ce Fixed #30798 -- Fixed Meta.ordering validation for pk of related fields.
Regression in 440505cb2c.
2019-09-27 14:22:31 +02:00
Hasan Ramezani c7944628a1 Refs #30798 -- Prevented chaining fields from the same related model multiple times in model Meta.ordering. 2019-09-27 13:57:22 +02:00
Simon Charette 8b3e1b6e9e Refs #11964 -- Made constraint support check respect required_db_features.
This will notably silence the warnings issued when running the test
suite on MySQL.
2019-08-12 06:44:37 +02:00
can 53209f7830 Fixed #30613 -- Moved index name validation to system checks. 2019-07-05 09:30:21 +02:00
zeyneloz 6485a5f450 Fixed #30409 -- Allowed using foreign key's attnames in unique/index_together and Index's fields. 2019-05-01 11:51:27 +02:00
Mariusz Felisiak f69c7bbdce
Refs #29408 -- Cosmetic edits for validation of related fields and lookups in model Meta.ordering.
Follow up to 440505cb2c.
2019-03-01 19:38:21 +01:00
Hasan Ramezani 440505cb2c Fixed #29408 -- Added validation of related fields and lookups in model Meta.ordering. 2019-03-01 17:09:33 +01:00
Hasan Ramezani ec16588c27 Added test for Model._check_column_name_clashes(). 2018-11-17 15:24:48 -05: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 Willison 586a9dc429 Fixed #26352 -- Made system check allow ManyToManyField to target the same model if through_fields differs. 2018-08-22 12:07:29 -04:00
Ian Foote 952f05a6db Fixed #11964 -- Added support for database check constraints. 2018-07-10 15:32:33 -04:00
Carlton Gibson 21fd8041c1
Refs #29358 -- Corrected wording in primary key check message. 2018-05-03 15:28:37 +02:00
Hasan Ramezani 816b8d9518 Fixed #29358 -- Added a system check to prohibit models with more than one primary_key field. 2018-05-03 09:08:29 +02:00