- Used selected "databases" instead of django.db.connections.
- Made routers in tests.migrations skip migrations on unexpected
databases.
- Added DiscoverRunnerGetDatabasesTests.assertSkippedDatabases() hook
which properly asserts messages about skipped databases.
Previously, this test could modify global state by changing
connection.settings_dict. This dict is a reference to the same dict as
django.db.connections.databases['default'], which is thus also changed.
The cleanup of this test would replace connection.settings_dic` with a
saved copy, which would leave the dict itself modified.
Additionally, create_test_db() would also modify these same dicts, as
well as settings.databases['default']['NAME'] by adding a "test_"
prefix, which is what can cause problems later.
This patch:
- makes a complete copy of the connection and work on that, to improve
isolation.
- calls destroy_test_db() to let that code clean up anything done by
create_test_db().
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.
The subtract_temporals() database operation was not handling expressions
returning SQL params in mixed database types.
Regression in 35431298226165986ad07e91f9d3aca721ff38ec.
Thanks Reupen Shah for the report.
Thanks Simon Charette and Carlton Gibson for reviews.
Co-Authored-By: Jonas Haag <jonas@lophus.org>
Co-Authored-By: Christophe Baldy <christophe.baldy@polyconseil.fr>
Added assertions to compare results of .add(), .delete(), .touch(),
.incr(), .decr(), and .get_or_set() methods.
Made tests use assertIs() rather than assertTrue/False().
Model.save_base() is called directly when loading fixtures and assumes
existing rows will be updated. Branching of "raw" allows to maintain
the optimization introduced in #29260 while supporting this edge case.
Regression in 85458e94e38c20e57939947ee515a1a53689659f.
Thanks Reupen Shah for the report.
This allows adding foreign key constraints inline and changing data in
the same migration on PostgreSQL 10+.
Regression in 738faf9da2a5cd03148a36375db80746c99c9623.
Thanks Janne Rönkkö for the report and Simon Charette for the
implementation idea and review.
Thanks Dmitriy Gunchenko for the report and Simon Charette for the
analysis and tests.
Regression in 5a4d7285bd10bd40d9f7e574a7c421eb21094858.
Fixed in 5a4d7285bd10bd40d9f7e574a7c421eb21094858.
Clearing the SELECT clause in Query.has_results was orphaning GROUP BY
references to it.
Thanks Thierry Bastian for the report and Baptiste Mispelon for the
bisect.
Regression in fb3f034f1c63160c0ff13c609acd01c18be12f80.