Commit Graph

282 Commits

Author SHA1 Message Date
Mariusz Felisiak 0b95a96ee1
Removed DatabaseIntrospection.get_key_columns().
Thanks Simon Charette for the report.
2021-11-10 16:38:43 +01:00
Anv3sh 69af4d09ba Fixed #32672 -- Fixed introspection of primary key constraints on SQLite.
Thanks Simon Charette for the implementation idea.
2021-10-26 09:50:23 +02:00
Manaia Junior 551c997fea Fixed #33214 -- Added BaseDatabaseOperations.format_for_duration_arithmetic() stub method. 2021-10-22 08:19:02 +02:00
Hannes Ljungberg 86971c4090 Fixed #33194 -- Fixed migrations when altering a field with functional indexes/unique constraints on SQLite.
This adjusts Expressions.rename_table_references() to only update alias
when needed.

Regression in 83fcfc9ec8.

Co-authored-by: Simon Charette <charettes@users.noreply.github.com>
2021-10-18 08:25:23 +02:00
Daniel Hahler 98c8bf1cee
Fixed #33160 -- Avoided suppressing query errors in _nodb_cursor() on PostgreSQL. 2021-10-01 07:23:57 +02:00
Matjaz Gregoric 518ce7a51f Fixed #33017 -- Fixed storage engine introspection on MySQL.
This also improves performance on MySQL instances with a large number
of databases, since querying the information_schema table can be very
slow
2021-08-20 11:05:21 +02:00
Mads Jensen c51bf80d56 Used more specific unittest assertions in tests. 2021-07-07 10:51:38 +02:00
Mateo Radman 2231429991 Refs #32508 -- Raised ImproperlyConfigured/TypeError instead of using "assert". 2021-07-05 13:31:03 +02:00
Nick Pope fa35c8bdbc
Fixed #30934 -- Included database alias in django.db.backends log messages.
This is useful when working with database routing as you want to know
where each query is being executed.

Co-authored-by: David Winterbottom <david.winterbottom@gmail.com>
2021-07-02 15:36:53 +02:00
Mariusz Felisiak 1f643c28b5
Fixed #32653 -- Made quoting names in the Oracle backend consistent with db_table. 2021-04-30 12:59:07 +02:00
Konstantin Alekseev 6e742dabc9 Fixed #32687 -- Restored passing process’ environment to underlying tool in dbshell on PostgreSQL.
Regression in bbe6fbb876.
2021-04-27 10:43:35 +02:00
Mariusz Felisiak f6018c1e63 Fixed #32595 -- Fixed SchemaEditor.quote_value() crash with bytes. 2021-03-30 11:42:15 +02:00
Mariusz Felisiak 3c75f1f3ca Refs #32595 -- Added MySQL's SchemaEditor.quote_value() tests for values with Unicode chars. 2021-03-30 11:42:15 +02:00
Girish Sontakke 5388ff2a52
Fixed #32582 -- Removed unnecessary dot in names of cloned test databases on SQLite. 2021-03-25 06:37:01 +01:00
Mariusz Felisiak 83443e62d3
Optimized FkConstraintsTests.test_check_constraints by specifying a database table. 2021-03-24 12:18:00 +01:00
Mariusz Felisiak f131841c60
Fixed #32403 -- Fixed re-raising DatabaseErrors when using only 'postgres' database.
Thanks Kazantcev Andrey for the report.

Regression in f48f671223.
2021-02-02 21:34:36 +01:00
Hasan Ramezani dcb3ad3319 Fixed #32292 -- Added support for connection by service name to PostgreSQL. 2021-01-20 17:30:37 +01:00
Mariusz Felisiak d992f4e3c2 Refs #31369 -- Removed models.NullBooleanField per deprecation timeline. 2021-01-14 17:50:04 +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
Mariusz Felisiak 74fd233b14
Fixed #32303 -- Bumped minimum supported SQLite to 3.9.0. 2020-12-30 09:01:56 +01:00
Chinmoy Chakraborty 270072c4c2 Fixed #32158 -- Fixed loaddata crash on SQLite when table/column names are SQL keywords. 2020-12-28 08:57:30 +01:00
Tim Graham 1e7653117f
Refs #32178 -- Fixed test_mark_expected_failures_and_skips_call teardown.
Test isolation failure observed on CockroachDB and PostgreSQL.
2020-12-11 21:06:33 +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
Mariusz Felisiak f5e5aac59e
Fixed #32224 -- Avoided suppressing connection errors in supports_json_field on SQLite.`
Regression in 6789ded0a6.

Thanks Juan Garcia Alvite for the report.
2020-11-25 12:19:45 +01:00
Hasan Ramezani 50c3ac6fa9 Fixed #31762 -- Made reloading the database for tests use the base manager.
Co-authored-by: Eugene Kulak <kulak.eugene@gmail.com>
2020-11-11 08:33:30 +01:00
Simon Charette bbe6fbb876 Refs #32061 -- Unified DatabaseClient.runshell() in db backends. 2020-10-29 22:22:58 +01:00
Martin Thoma 302caa40e4 Made small readability improvements. 2020-10-28 20:20:20 +01:00
Mariusz Felisiak 77caeaea88
Fixed #32012 -- Made test database creation sync apps models when migrations are disabled.
Thanks Jaap Roes for the report.
2020-09-23 10:54:04 +02:00
Mariusz Felisiak 3b8857b51a Corrected tests.backends.sqlite.tests.Tests.test_aggregation()'s docstring. 2020-09-13 20:09:44 +02:00
Mariusz Felisiak 0be51d2226 Fixed #31956 -- Fixed crash of ordering by JSONField with a custom decoder on PostgreSQL.
Thanks Marc Debureaux for the report.
Thanks Simon Charette, Nick Pope, and Adam Johnson for reviews.
2020-08-28 19:09:46 +02:00
David Smith e74b3d724e Bumped minimum isort version to 5.1.0.
Fixed inner imports per isort 5.
isort 5.0.0 to 5.1.0 was unstable.
2020-07-30 10:58:59 +02:00
Mariusz Felisiak 83f55aafdd
Fixed #17653 -- Allowed using zero as AutoFields value on MySQL if NO_AUTO_VALUE_ON_ZERO SQL mode is enabled. 2020-07-20 09:48:31 +02:00
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
Jon Dufresne d6aff369ad Refs #30116 -- Simplified regex match group access with Match.__getitem__().
The method has been available since Python 3.6. The shorter syntax is
also marginally faster.
2020-05-11 12:01:28 +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
Mariusz Felisiak d5898db50e
Fixed backends.oracle.test_operations.
Using unittest.TestCase doesn't work properly when we perform db
queries. Moreover introspection is extremely slow on Oracle without
limiting models to a "backends" app.

Follow up to 8bcca47e83.
2020-04-21 15:46:18 +02:00
Jon Dufresne 75866b93cc Fixed #31479 -- Added support to reset sequences on SQLite. 2020-04-21 10:41:47 +02:00
Jon Dufresne 505fec6bad Capitalized Unicode in docs, strings, and comments. 2020-04-20 12:10:33 +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 537d422942
Simplified LongNameTest.test_sequence_name_length_limits_flush() with execute_sql_flush(). 2020-04-18 20:48:30 +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 94d4bd3a09
Fixed backends tests on Oracle.
Using Person in test_introspection caused removing constraints in
intermediate table for ManyToManyField in
VeryLongModelNameZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ that were
expected by other transaction tests. A model without any constraints
was used to prevent isolation issues.
2020-02-24 14:21:50 +01:00