Commit Graph

28 Commits

Author SHA1 Message Date
Sergey Fedoseev dd5aa8cb5f Fixed #28925 -- Fixed durations-only expressions crash on SQLite and MySQL.
This removes also unused DatabaseOperations.date_interval_sql().
2020-06-30 07:04: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
Adam Johnson 1c2c6f1b51
Fixed a/an typos in "SQL" usage. 2020-05-06 06:35:26 +02:00
Jon Dufresne 5673d4b102
Fixed #31477 -- Removed "using" argument from DatabaseOperations.execute_sql_flush(). 2020-04-20 07:49:35 +02:00
Jon Dufresne 75410228df Fixed #31473 -- Made sql_flush() use RESTART IDENTITY to reset sequences on PostgreSQL.
The sql_flush() positional argument sequences is replaced by the boolean
keyword-only argument reset_sequences. This ensures that the old
function signature can't be used by mistake when upgrading Django. When
the new argument is True, the sequences of the truncated tables will
reset. Using a single boolean value, rather than a list, allows making a
binary yes/no choice as to whether to reset all sequences rather than a
working on a completely different set.
2020-04-17 11:57:24 +02:00
Jon Dufresne 8bcca47e83 Added test coverage for DatabaseOperations.sql_flush(). 2020-04-17 09:52:43 +02:00
Mariusz Felisiak 537b0c5edf
Fixed typo in tests/backends/base/test_operations.py. 2020-04-08 20:06:31 +02:00
Matthijs Kooijman 289d0ec6fd Refs #31051 -- Fixed reloading the database with circular related objects and natural keys for tests.
Made deserialize_db_from_string() do not sort dependencies.

deserialize_db_from_string() doesn't use natural keys, so there is no
need to sort dependencies in serialize_db_to_string(). Moreover,
sorting models cause issues for circular dependencies.
2020-04-02 11:35:33 +02:00
Matthijs Kooijman 12e6f573ad Refs #26552 -- Added test for reloading the database with self-referential objects. 2020-04-02 09:17:41 +02:00
shankarj67 df4d622cac Fixed #31345 -- Added BaseDatabaseIntrospection.get_relations(). 2020-03-06 08:53:32 +01:00
aryan 427a7e419b Fixed #31333 -- Added BaseDatabaseIntrospection.get_table_description(). 2020-03-04 12:26:31 +01:00
Mariusz Felisiak 6dea42feba Added tests for BaseDatabaseIntrospection's stub methods. 2020-03-04 12:25:17 +01:00
Mariusz Felisiak 4261907ff3 Fixed tests when run in reverse.
Regression in 98f23a8af0.
2020-02-19 14:48:26 +01:00
Matthijs Kooijman 98f23a8af0 Fixed #26552 -- Deferred constraint checks when reloading the database with data for tests.
deserialize_db_from_string() loads the full serialized database
contents, which might contain forward references and cycles. That
caused IntegrityError because constraints were checked immediately.

Now, it loads data in a transaction with constraint checks deferred
until the end of the transaction.
2020-02-14 13:18:06 +01:00
Matthijs Kooijman b64b1b2e1a Fixed #31117 -- Isolated backends.base.test_creation.TestDbCreationTests.
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().
2020-01-20 11:00:17 +01:00
Mariusz Felisiak f34be5294d Refs #31117 -- Moved get_connection_copy() test hook to a module level. 2020-01-20 11:00:05 +01:00
Jon Dufresne f5ebdfce5c Fixed #25388 -- Added an option to allow disabling of migrations during test database creation. 2019-11-20 20:42:38 +01:00
Ville Skyttä 03db5fddfd Fixed typos in docs, comments, and exception messages. 2019-04-18 09:33:53 +02:00
Simon Charette b181aba7dd Refs #28478 -- Prevented database feature based skipping on tests disallowing queries.
Database features may require a connection to be established to determine
whether or not they are enabled.
2019-01-14 16:16:30 -05:00
Tim Graham 193c109327 Switched TestCase to SimpleTestCase where possible in Django's tests. 2018-11-27 08:58:44 -05:00
Tim Graham 9cac10eee4 Added BaseDatabaseSchemaEditor._effective_default() to allow testing without a connection. 2018-11-17 19:27:53 -05:00
Tim Graham e62f6e0968 Fixed #29505 -- Removed SchemaEditor's calling of callable defaults.
Thanks Eugene Pakhomov for the suggested fix.
2018-11-17 19:27:53 -05:00
Jon Dufresne 7598cd4748 Fixed #29813 -- Fixed DatabaseOperation test when run in isolation on MySQL. 2018-10-02 08:22:38 -04:00
Matthew Wilkes 2162f0983d Fixed #24747 -- Allowed transforms in QuerySet.order_by() and distinct(*fields). 2018-02-10 19:08:55 -05:00
Mads Jensen 41406bf98e Increased test coverage for db/backends/base/operations.py. 2017-09-30 19:48:55 -04:00
Shai Berger d612026c37 Refs #28595 -- Added a hook to add execute wrappers for database queries.
Thanks Adam Johnson, Carl Meyer, Anssi Kääriäinen, Mariusz Felisiak,
Michael Manfre, and Tim Graham for discussion and review.
2017-09-21 12:13:09 -04:00
Mads Jensen d549b88050 Fixed #26608 -- Added support for window expressions (OVER clause).
Thanks Josh Smeaton, Mariusz Felisiak, Sergey Fedoseev, Simon Charettes,
Adam Chainz/Johnson and Tim Graham for comments and reviews and Jamie
Cockburn for initial patch.
2017-09-18 09:42:29 -04:00
Mariusz Felisiak 8cb1b1fd8e Reorganized backends tests. 2017-06-21 12:00:47 -04:00