Commit Graph

1559 Commits

Author SHA1 Message Date
Tim Graham 7e6b214ed3 Fixed #30116 -- Dropped support for Python 3.5. 2019-01-30 10:19:48 -05: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
Tim Graham 7444f32527
Refs #30055 -- Added a helpful error when SQLite is too old. 2019-01-28 11:14:45 -05:00
Nick Pope bff748df3e Fixed #30115 -- Fixed SQLite introspection crash with a varchar primary key.
Removed obsolete max_length handling for CharField that caused the issue.
Regression in a35d2a4510.
2019-01-22 19:02:34 -05:00
Nick Pope e19f58fc01 Inlined DatabaseIntrospection._table_info() for SQLite. 2019-01-22 18:23:37 -05:00
Mariusz Felisiak 709a8b861d
Optimized Oracle PKs introspection by adding get_primary_key_column(). 2019-01-18 16:50:06 +01:00
Tim Graham 944469939b Refs #25175 -- Removed db.backends.postgresql_psycopg2 per deprecation timeline. 2019-01-17 10:50:25 -05:00
Simon Charette a96b901932 Refs #28478 -- Prevented timezone assignment for unusable PostgreSQL connections. 2019-01-14 16:05:00 -05:00
Nick Pope abf8e390a4 Refs #28643 -- Added Reverse database function.
Thanks Mariusz Felisiak for Oracle advice and review.
2019-01-12 10:45:48 -05:00
Paveł Tyślacki b69f8eb04c Fixed #30062 -- Added support for unique conditional constraints. 2019-01-12 09:50:20 -05:00
Paveł Tyślacki 1e837c4b23 Used None as the empty value for condition in Index's SQL construction. 2019-01-12 09:34:10 -05:00
Paveł Tyślacki 647be06538 Renamed variables after generalization of constraints.
Follow up to 8eae094638.
2019-01-10 18:54:41 -05:00
Simon Charette bc05547cd8 Fixed #28658 -- Added DISTINCT handling to the Aggregate class. 2019-01-09 17:52:36 -05:00
Nick Pope a35d2a4510 Refs #23748 -- Added AutoField introspection for SQLite. 2019-01-09 09:59:15 -05:00
Nick Pope e7f0e9b704 Renamed import in MySQL introspection backend for consistency. 2019-01-09 08:12:45 -05:00
Mariusz Felisiak 97844a3213
Fixed typo in django/db/backends/base/features.py. 2019-01-03 20:10:33 +01:00
Paveł Tyślacki 0123b67f6b Fixed #30060 -- Moved SQL generation for indexes and constraints to SchemaEditor. 2019-01-01 09:39:58 -05:00
Tim Graham b74b6736d0
Refs #29547 -- Skipped an unsupported partial index test on older versions of SQLite.
Follow up to e5b8626c0e.
2018-12-26 11:20:11 -05:00
Simon Charette ec7bf6d826 Refs #20483 -- Cached Oracle references retrieval on sql_flush(). 2018-12-26 09:20:21 -05:00
Simon Charette 2b2ae4eeb7 Refs #30054, #20483 -- Cached SQLite references graph retrieval on sql_flush(). 2018-12-26 09:19:44 -05:00
Nick Pope 83677faf86 Fixed #30056 -- Added SQLite support for StdDev and Variance functions. 2018-12-24 11:14:58 -05:00
Nick Pope e626a3f993 Renamed Sqlite and Sqlite3 references to SQLite. 2018-12-22 18:52:54 -05:00
Simon Charette ce8b65ac5e Fixed #30054 -- Implemented cascaded flush on SQLite.
This is required to maintain foreign key integrity when using
TransactionTestCase.available_apps.

Refs #30033, #14204, #20483.
2018-12-22 17:47:48 -05:00
Tim Graham d5af14aa84 Fixed #30055 -- Dropped support for SQLite < 3.8.3. 2018-12-22 16:59:28 -05:00
Simon Charette 790d108c97 Refs #30033 -- Checked constraints before committing SQLite schema changes.
This order of operations is more in line with SQLite's documented table
rebuild procedure and ensures that changes aren't committed if foreign key
integrity is broken.
2018-12-22 15:26:46 -05:00
Simon Charette 6b9bd0933e Refs #29928 -- Added supports_pragma_foreign_key_check SQLite feature flag. 2018-12-22 15:14:33 -05:00
Simon Charette f3eb1cfb58 Refs #29928 -- Corrected SQLite's can_defer_constraint_checks feature flag. 2018-12-22 15:13:46 -05:00
Simon Charette 25a0781a16 Refs #29182 -- Corrected SQLite's supports_atomic_references_rename feature flag. 2018-12-22 14:58:08 -05:00
Simon Charette e5b8626c0e Refs #29547 -- Corrected SQLite's supports_partial_indexes feature flag. 2018-12-22 14:51:59 -05:00
Simon Charette 20f6f9eaa1 Renamed SQLite3 references to to SQLite.
The version suffix isn't part of the product name.
2018-12-22 14:20:43 -05:00
Simon Charette 1939dd49d1 Fixed #29928 -- Enabled deferred constraint checks on SQLite 3.20+.
Refs #11665, #14204.

Thanks Michel Samia for the report.
2018-12-17 11:03:44 +01:00
Simon Charette 894cb13779 Refs #29182 -- Stopped relying on legacy alter table semantic on SQLite 3.26+.
SQLite 3.26 changed the behavior of table and column renaming operations to
repoint foreign key references even if foreign key checks are disabled.

This makes the workarounds in place to simulate this behavior unnecessary on
SQLite 3.26+. Refs #30033.
2018-12-17 10:44:05 +01:00
Simon Charette 7289874adc Fixed #30033 -- Conformed to the recommended table alterations procedure on SQlite3.
Refs #29182.

The previous implementation was following a procedure explicitly documented
as incorrect and was the origin of the breakage experienced on SQLite 3.26
release that were addressed by c8ffdbe514.

Thanks to Richard Hipp for pointing out the usage of the incorrect procedure.
2018-12-17 10:44:05 +01:00
Simon Charette a939d630a4 Refs #29928 -- Implemented fast constraint checking on SQLite 3.20+. 2018-12-17 10:44:05 +01:00
Simon Charette 315357ad25 Fixed #30023 -- Prevented SQLite schema alterations while foreign key checks are enabled.
Prior to this change foreign key constraint references could be left pointing
at tables dropped during operations simulating unsupported table alterations
because of an unexpected failure to disable foreign key constraint checks.

SQLite3 does not allow disabling such checks while in a transaction so they
must be disabled beforehand.

Thanks ezaquarii for the report and Carlton and Tim for the review.
2018-12-15 18:51:59 -05:00
Mariusz Felisiak f0082b9a77
Refs #28670 -- Fixed DatabaseFeatures.supports_slicing_ordering_in_compound on Oracle. 2018-12-10 12:56:09 +00:00
Simon Charette c8ffdbe514 Fixed #29182 -- Fixed schema table alteration on SQLite 3.26+.
SQLite 3.26 repoints foreign key constraints on table renames even when
foreign_keys pragma is off which breaks every operation that requires
a table rebuild to simulate unsupported ALTER TABLE statements.

The newly introduced legacy_alter_table pragma disables this behavior
and restores the previous schema editor assumptions.

Thanks Florian Apolloner, Christoph Trassl, Chris Lamb for the report and
troubleshooting assistance.
2018-12-07 13:32:37 -05:00
Mariusz Felisiak f9a33e3c3f Fixed #29932 -- Fixed combining compound queries with sub-compound queries on SQLite and Oracle. 2018-12-06 15:31:33 -05:00
Tim Graham 88619e6129
Bumped mysqlclient requirement to >= 1.3.13.
There are test failures with older versions.
2018-12-06 14:49:27 -05:00
Tim Graham 284b3221a2 Fixed #30013 -- Fixed DatabaseOperations.last_executed_query() with mysqlclient 1.3.14+. 2018-12-05 14:46:23 -05:00
Mariusz Felisiak f091ea3515
Refs #29722 -- Added introspection of materialized views for Oracle.
Thanks Tim Graham for the review.
2018-11-26 19:45:05 +01:00
Mariusz Felisiak d5f4ce9849
Fixed #29949 -- Refactored db introspection identifier converters.
Removed DatabaseIntrospection.table_name_converter()/column_name_converter()
and use instead DatabaseIntrospection.identifier_converter().

Removed DatabaseFeatures.uppercases_column_names.

Thanks Tim Graham for the initial patch and review and Simon Charette
for the review.
2018-11-21 09:06:50 +01:00
Tim Graham acdd18dffc
Changed BaseDatabaseSchemaEditor._effective_default() to staticmethod.
Follow up to 9cac10eee4.
2018-11-20 18:01:18 -05:00
Nick Pope ebd270627c Refs #29722 -- Added introspection of partitions for PostgreSQL. 2018-11-19 14:06:01 -05:00
Sergey Fedoseev 80ba7a881f Fixed cached_properties that share a common property.
The aliases aren't cached and thus the old usage will be an error after
refs #29478.
2018-11-19 08:59:46 -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
Mariusz Felisiak ff8020ed49 Fixed #29788 -- Added support for Oracle Managed File (OMF) tablespaces. 2018-11-13 18:22:41 -05:00
Simon Charette db13bca60a Fixed #29641 -- Added support for unique constraints in Meta.constraints.
This constraint is similar to Meta.unique_together but also allows
specifying a name.

Co-authored-by: Ian Foote <python@ian.feete.org>
2018-11-13 17:57:27 -05:00
Simon Charette dba4a634ba Refs #29641 -- Refactored database schema constraint creation.
Added a test for constraint names in the database.

Updated SQLite introspection to use sqlparse to allow reading the
constraint name for table check and unique constraints.

Co-authored-by: Ian Foote <python@ian.feete.org>
2018-11-13 15:25:44 -05:00