Commit Graph

1021 Commits

Author SHA1 Message Date
Tim Graham 478d6a9503 Copied BaseDatabaseCreation._digest() to SchemaEditor to remove dependency.
refs #22340.
2014-12-31 08:33:34 -05:00
Tim Graham 93d73dac91 Moved DatabaseCreation.data_types properties to DatabaseWrapper.
refs #22340.
2014-12-31 08:29:17 -05:00
Tim Graham 8082c75d18 Removed db.backends methods which only call super(). 2014-12-30 11:53:59 -05:00
Andriy Sokolovskiy 8c99b7920e Fixed #12118 -- Added shared cache support to SQLite in-memory testing. 2014-12-30 10:14:33 -05:00
Tim Graham ab4f709da4 Fixed #23581 -- Prevented extraneous DROP DEFAULT statements.
Thanks john_scott for the report and Markus Holtermann for review.
2014-12-30 07:54:05 -05:00
Claude Paroz 3c5d1edb39 Fixed #22279 -- Prevented dummy backend going through DatabaseErrorWrapper
Thanks Daniel Hahler for the report and Tim Graham for the review.
2014-12-29 19:06:28 +01:00
Claude Paroz 2ceb10f3b0 Fixed #14180 -- Prevented unneeded index creation on MySQL-InnoDB
Thanks zimnyx for the report and Simon Charette, Tim Graham for
the reviews.
2014-12-27 12:52:44 +01:00
Josh Smeaton 4718296546 Fixed #23753 -- Added a suite of SQL Functions
Added functions and tests
Added docs and more tests
Added TextField converter to mysql backend
Aliased Value as V in example docs and tests
Removed unicode_compatible in example
Fixed console emulation in examples
2014-12-27 15:27:27 +11:00
Claude Paroz 30cbd5d360 Replaced DatabaseCreation sql methods by schema editor equivalents
Also used schema editor in migrate to sync unmigrated apps (sync_apps).
Refs #22340. Thanks Tim Graham for the review.
2014-12-23 19:35:01 +01:00
Anssi Kääriäinen 227a4c48be Refs #2443 -- fixed format_dtdelta on SQLite
A test failed on Python 2 32-bit.
2014-12-23 07:05:44 -05:00
Marc Tamlyn 962bb9b6bd Refs #2443 -- Move the durationfield converter logic.
This reduces how frequently this logic is run significantly.

Thanks to Anssi for the suggestion.
2014-12-23 10:41:42 +00:00
Marc Tamlyn 5ca82e710e Fixed #24033 -- Use interval type on Oracle.
Use INTERVAL DAY(9) TO SECOND(6) for Durationfield on Oracle rather than
storing as a NUMBER(19) of microseconds.

There are issues with cx_Oracle which require some extra data
manipulation in the database backend when constructing queries, but it
handles the conversion back to timedelta objects cleanly.

Thanks to Shai for the review.
2014-12-23 10:38:32 +00:00
Marc Tamlyn 07728a2c2c Refs #2443 -- Fix Oracle tests for DurationField.
It helps if there are the correct number of microseconds in a second.
2014-12-20 22:04:07 +00:00
Marc Tamlyn 57554442fe Fixed #2443 -- Added DurationField.
A field for storing periods of time - modeled in Python by timedelta. It
is stored in the native interval data type on PostgreSQL and as a bigint
of microseconds on other backends.

Also includes significant changes to the internals of time related maths
in expressions, including the removal of DateModifierNode.

Thanks to Tim and Josh in particular for reviews.
2014-12-20 18:28:29 +00:00
Andriy Sokolovskiy 089047331d Fixed #23987 -- Made SQLite SchemaEditor always use effective_default(). 2014-12-15 13:40:24 -05:00
Shai Berger 7c1f3901bc Fixed #23991 -- Apparently, Oracle doesn't need the decimal field converter
Thanks Josh Smeaton for review.
2014-12-15 00:07:10 +02:00
Claude Paroz df30ae07fc Fixed postgis test database initialization
Refs #20968. Allow querying template_postgis presence without
existing test database.
Thanks Tim Graham for the review.
2014-12-12 20:08:07 +01:00
Josh Smeaton 267a1dcd9b Fixed #23941 -- Removed implicit decimal formatting from expressions. 2014-12-12 10:17:48 -05:00
Claude Paroz 8f97413fae Fixed #20968 -- Checked Spatialite metadata before migrations
Thanks Kenial S. Lee for the initial patch and Tim Graham for
the review.
2014-12-08 22:22:53 +01:00
Jon Dufresne 4468c08d70 Fixed #23968 -- Replaced list comprehension with generators and dict comprehension 2014-12-08 07:58:23 -05:00
Claude Paroz 8d7a48027e Fixed #23954 -- Added special text/varchar PostgreSQL indexes in migrations
Thanks adityagupta104 for the report and Tim Graham for the review.
2014-12-04 21:27:42 +01:00
Tim Graham 765fa36d57 Fixed #23920 -- Fixed MySQL crash when adding blank=True to TextField.
Thanks wkornewald for the report and Markus Holtermann for review.
2014-12-04 10:57:10 -05:00
Andriy Sokolovskiy 1739ae9edc Fixed #23807 -- Ignored non-digits in psycopg2 version 2014-12-01 18:42:08 -05:00
Claude Paroz e11c6fd218 Fixed #23909 -- Prevented crash when collecting SQL for RunSQL
Thanks James Rivett-Carnac for the report and Markus Holtermann
for the review.
2014-12-01 20:26:40 +01:00
Markus Holtermann d2202ec2d4 Fixed #23880 -- Added missing index_together handling for SQLite 2014-12-01 11:30:33 +07:00
Thomas Chaumeny 6b5d82749c Fixed #16731 -- Made pattern lookups work properly with F() expressions 2014-11-28 12:50:42 +02:00
Anssi Kääriäinen cbb5cdd155 Fixed #23867 -- removed DateQuerySet hacks
The .dates() queries were implemented by using custom Query, QuerySet,
and Compiler classes. Instead implement them by using expressions and
database converters APIs.
2014-11-26 17:49:25 -05:00
Collin Anderson d4ea4eea79 Fixed #23889 -- Added more usage of quote_name_unless_alias() to avoid deprecation warnings. 2014-11-21 16:44:50 -05:00
Brad Walker cfa26f29bd Reduced reduce() usage; refs #23796.
django.core.exceptions.ValidationError.messages() and
django.db.backends.schema.BaseDatabaseSchemaEditor._alter_field():
Replaced reduce(operator.add, ...) w/uncoupled, explicit sum()
2014-11-20 14:31:14 -05:00
Claude Paroz 1a63093e22 Added AutoField introspection for PostgreSQL
Refs #23748.
2014-11-20 16:13:58 +01:00
Claude Paroz 11662022be Added AutoField introspection for MySQL
Refs #23748.
2014-11-20 16:13:58 +01:00
Tim Graham 5bcd292098 Fixed #23871 -- Removed promotion of MySQL warnings to errors in DEBUG mode. 2014-11-19 16:07:49 -05:00
Josh Smeaton f59fd15c49 Fixed #14030 -- Allowed annotations to accept all expressions 2014-11-15 14:00:43 +00:00
Thomas Chaumeny 88b2a20f04 Simplified MySQL storage engine detection using INFORMATION_SCHEMA.ENGINES table
Query the table introduced in MySQL 5.1; refs #23144.
2014-11-10 18:16:14 +01:00
Markus Holtermann 715ccfde24 Fixed #23738 -- Allowed migrating from NULL to NOT NULL with the same default value
Thanks to Andrey Antukh for the report.
2014-10-31 13:30:30 -04:00
Claude Paroz 713f23492a Required MySQLdb >= 1.2.5 for fractional seconds support
On MySQLdb < 1.2.5, MySQLdb returns None when fetching datetime/time
values with fractional seconds.
See https://github.com/farcepest/MySQLdb1/issues/24
2014-10-28 15:06:58 +01:00
Claude Paroz 22da5f8817 Fixed #19716 -- Added support for microseconds with MySQL 5.6.4 and up
Thanks erik@cederstrand.dk for the report and Tim Graham for the review.
2014-10-28 15:06:58 +01:00
Claude Paroz 9e746c13e8 Stopped stripping microseconds with MySQL backend
Refs #19716.
2014-10-28 15:06:57 +01:00
Claude Paroz 5b8e37a69e Fixed typo in MySQL backend doctring
Thanks CHI Cheng for the report.
2014-10-27 14:01:12 +01:00
Mikhail Denisenko d4bc0bf435 Fixed #22879 -- Intercept errors coming from cursor.__next__() 2014-10-27 14:51:40 +02:00
Claude Paroz 7f089ac2e3 Fixed #23446 -- Officially recommended mysqlclient as MySQL driver
Thanks Corey Farwell for the report and Tim Graham for the review.
Thanks also to Inada Naoki for creating and maintaining mysqlclient.
2014-10-27 09:11:33 +01:00
Claude Paroz 45db842c9b Fixed #23652 -- Restored database name after destroying test database
Thanks Bjarkias for the report.
2014-10-24 17:04:43 +02:00
Tim Graham 92269b7b53 Fixed #23702 -- Fixed adding an explicit id field on SQLite.
Thanks gavinwahl for the report.
2014-10-23 12:24:34 -04:00
Shai Berger 2e1ed5f33c Fixed #23649 -- Made Oracle test-db creation drop test-user earlier when needed
Checked database destruction for ORA-29857, which happens when objects of
some types are left over in an old test database (notably, such objects
are created by the GIS backend). When this happens, we can resolve the
issue by dropping the test-user (if we are allowed to).

An alternative approach, to just switch the order of creation (so that,
if the test user exists and can be dropped, it is always dropped before
the tablespace) was considered; but since the user creation depends on
the tablespace, this would necessitate separating the dropping of the user
from its creation -- a change I am reluctant to make.

Thanks Josh Smeaton and Tim Graham for reviews.
2014-10-17 04:46:15 +03:00
Collin Anderson a6a8268d19 Fixed #23660 -- Moved sort_dependencies to core. 2014-10-16 03:04:13 +07:00
Markus Holtermann f633ba778d Fixed #23609 -- Fixed IntegrityError that prevented altering a NULL column into a NOT NULL one due to existing rows
Thanks to Simon Charette, Loic Bistuer and Tim Graham for the review.
2014-10-09 21:32:06 +07:00
Thomas Chaumeny b2aad7b836 Replaced set([foo, ...]) by {foo, ...} literals. Refs PR 3282.
Thanks Collin Anderson for the review.
2014-09-29 00:01:38 +07:00
Shai Berger a54adcecff Fixed git blunder, refs #22738 2014-09-27 09:57:09 +03:00
Shai Berger c1ae0621ba Fixed #22738 -- made finer distinctions for when Boolean is not detected on Oracle
Thanks Claude Paroz for partial fix and Simon Charrette for review
2014-09-27 09:49:50 +03:00
Claude Paroz dbdae3a755 Fixed #22738 -- Abstracted boolean field type introspection
Thanks maxi for the report, Shai Berger for his help with the patch
and Tim Graham for the review.
2014-09-26 20:03:44 +02:00
Claude Paroz d1ca70110f Factorized schema_editor() at BaseDatabaseWrapper level 2014-09-26 08:50:16 +02:00
Tim Graham 74e7f91e6d Fixed #23538 -- Added SchemaEditor for MySQL GIS.
Thanks Claude Paroz for suggestions and review.
2014-09-25 13:53:44 -04:00
Tim Graham 0aca91cf7f Fixed flake8 warnings. 2014-09-24 06:32:42 -04:00
Shai Berger d128eac316 Changed Oracle test-user creation to grant privileges instead of roles
because the roles (specifically RESOURCE) are deprecated.
Also added optional support for creating views in tests, and made an
introspection test fail (rather than skip)  if a view cannot be created
due to lacking privileges.

Refs #18782

Thanks Tim Graham for review, and Josh Smeaton
2014-09-24 04:58:33 +03:00
Claude Paroz ed297061a6 Fixed #18782 -- Prevented sql_flush to flush views
Thanks rodolfo_3 for the report and the initial patch, and
Josh Smeaton, Shai Berger and Tim Graham for the reviews.
2014-09-23 20:13:31 +02:00
Claude Paroz b8cdc7dcc3 Made get_table_list return a TableInfo named tuple 2014-09-23 20:13:31 +02:00
Sergey Fedoseev 463952d940 Fixed #23503 -- Fixed renaming of model with self-referential m2m field. 2014-09-23 10:03:37 -04:00
Sergey Fedoseev 83cd18633f Fixed #23065 -- Quoted constraint names in SQL generated by migrations. 2014-09-23 09:25:31 -04:00
Sergey Fedoseev 0bea6c8749 Factored create_fk_sql, create_unique_sql, and delete_constraint_sql. 2014-09-23 09:24:32 -04:00
Josh Smeaton 0eb5cde9da Fixed #21775 -- Allowed customization of datafile for Oracle tablespace 2014-09-17 09:55:33 -04:00
Marc Tamlyn ed7821231b Fixed #19463 -- Added UUIDField
Uses native support in postgres, and char(32) on other backends.
2014-09-16 10:08:09 +01:00
Claude Paroz 6072f17d09 Factorized create_index_sql expression 2014-09-13 21:34:37 +02:00
Josh Smeaton 638d1393ee Fixed #23434 -- Coerce Oracle bool params to int 2014-09-08 10:11:20 -04:00
Marc Tamlyn 14c8456ffe Fixed #23416 -- Make sure DatabaseCreation respects checks.
Migrations respected Field.db_parameters()['check'], but
DatabaseCreation was still using just Field.db_type().
2014-09-06 19:01:06 +01:00
Tim Graham 1101467ce0 Limited lines to 119 characters in django/
refs #23395.
2014-09-05 09:22:16 -04:00
Marc Tamlyn e9103402c0 Fixed #18757, #14462, #21565 -- Reworked database-python type conversions
Complete rework of translating data values from database

Deprecation of SubfieldBase, removal of resolve_columns and
convert_values in favour of a more general converter based approach and
public API Field.from_db_value(). Now works seamlessly with aggregation,
.values() and raw queries.

Thanks to akaariai in particular for extensive advice and inspiration,
also to shaib, manfre and timograham for their reviews.
2014-09-03 20:36:03 +01:00
Jon Dufresne f0d3dd4f04 Fixed #23357 -- Added small int introspection support to MySQL backend.
In the MySQL backend, updated the can_introspect_small_integer feature
flag to True. In data_types_reverse, map FIELD_TYPE.SHORT to a
SmallIntegerField. Added test to verify introspecting SmallIntegerFields
and fixed existing tests influenced by this change.
2014-08-27 10:58:44 -04:00
Shai Berger 4c85a0d95f Made main user disconnect after creating test user/tablespaces on Oracle 2014-08-25 20:20:10 +03:00
Shai Berger a6222af0ed Added docstring forgotten in 56252e7. 2014-08-22 05:37:36 +03:00
Shai Berger 56252e7f46 Fixed schema test for Oracle 11.2.0.1 which is used in Django Project's CI.
Refs #23073 Workaround.

Refs #22738 Repeats the mysql "offense". When the issue is solved, the
Oracle special case should be made to play with the solution (that is,
Oracle should be fixed the same way that mysql and the 3rd-party backneds
are).
2014-08-22 05:08:53 +03:00
Claude Paroz 6295ea0027 Replaced HAS_SPATIAL_DB by testing database feature
Refs #22632. This should be the base for using more database
features to exclude specific backends in GIS tests.
Thanks Tim Graham for the review.
2014-08-19 17:57:01 +02:00
zsoldosp 01801edd37 Fixed #22646: Added support for the MySQL ssl-ca option to dbshell. 2014-08-13 18:29:42 -04:00
Florian Apolloner 61d783f3d7 Made sqlite's remove_field behave like the base backend. 2014-08-10 13:31:06 +02:00
Claude Paroz dc462a8ed5 Removed unused migrate option 2014-08-09 17:13:00 +02:00
Andrew Godwin 27b6f28435 Fixed #23264: Schema backends honour db_constraint 2014-08-09 17:50:00 +10:00
Andrew Godwin 8d93b21ec9 Moved index dropping after FK dropping to please MySQL and fix test 2014-08-07 11:59:11 +10:00
Alex Hill 938da36cb1 Fixed #21603 -- Fixed complex RawQuerySets queries on some versions of SQLite. 2014-08-06 08:41:34 -04:00
Shai Berger 746f2a4bed Fixed #23061: Avoided setting a limit on a query for get with select_for_update on Oracle
Thanks Michael Miller for reporting the issue.
2014-08-05 03:12:08 +03:00
Mihail Milushev bf5382c6e5 Fixed #22234 -- Replaced OS-specific code with subprocess.call() in dbshell.
This fixes escaping of special characters on Windows.
2014-08-04 09:21:03 -04:00
Andrew Godwin c06e124b5e Fixed #23091: CreateModel and AddField were clashing with deferred SQL 2014-08-04 11:59:29 +10:00
Tim Graham d28396f526 Fixed #23144 -- Dropped support for MySQL 5.0, 5.1. 2014-08-02 10:28:40 -04:00
Tim Graham 8f9d6e83a0 Fixed #23145 -- Dropped support for Oracle < 11.1 2014-08-01 19:32:00 -04:00
Tim Graham a9bdce7e55 Fixed #23108 -- Dropped support for PostgreSQL 8.4 & PostGIS 1.3, 1.4.
Thanks Claude Paroz for the review.
2014-08-01 10:26:00 -04:00
Aymeric Augustin 729e4ae4f0 Fixed #23074 -- Avoided leaking savepoints in atomic.
Thanks Chow Loong Jin for the report and the initial patch.
2014-07-28 14:30:41 +02:00
areski 90faa196f6 Fixed #22873 -- Renamed use_debug_cursor to force_debug_cursor to clarify the behavior. 2014-07-26 10:38:46 -04:00
Andrew Godwin 08681d7757 Fixed #23085: Better error message for PostGIS 1.5/bad custom fields 2014-07-25 09:49:51 -07:00
Claude Paroz 8c30df15f1 Fixed #23030 -- Properly handled geometry columns metadata during migrations
Thanks kunitoki for the report and initial patches.
2014-07-23 12:10:23 +02:00
Andrew Godwin e24e9e0438 Fixed #23014: Renaming not atomic with unique together 2014-07-21 11:36:34 +01:00
Andrew Godwin 7dacc6ae46 Fixed #23009: Shorten FK identifiers in add_field and make consistent 2014-07-21 10:50:21 +01:00
Andrew Godwin dcb4ed5170 Fixed #22975: Don't call rename SQL if not needed 2014-07-21 10:14:00 +01:00
Andrew Godwin 2984b30ce8 Fixed #23039: Don't try to serialize unmanaged models in tests 2014-07-21 10:09:31 +01:00
Andrew Godwin 5875b8d133 Fixed #23043: alter_field drops defaults too 2014-07-21 10:04:36 +01:00
Shai Berger dd9b3312d0 Fixed name of database connection feature 2014-07-14 19:23:57 +03:00
Andrew Godwin 0fba4c0ed7 Fixed #22487: Don't flush out data from before normal TestCases 2014-06-23 20:25:09 -07:00
Anubhav Joshi 1c50d6ae2b Fixed problem introduced with #refs 13711. 2014-06-23 19:36:40 +03:00
Vlastimil Zíma 78c32f1caa Fixed #22514 -- Prevented indexes on virtual fields [postgres]. 2014-06-20 11:59:02 -04:00
Anubhav Joshi 91f1b6dcdc Fixed #13711 -- Model check added to ensure that auto-generated column name is within limits of the database.
Thanks russellm for report and Tim Graham for review.
2014-06-17 16:16:02 -04:00
Andrew Godwin b22917bd50 Fixed #22851: BinaryView wasn't getting a binary default 2014-06-16 18:44:08 -07:00
Tim Graham 82c935d44c Renamed DatabaseFeature.supports_check_constraints to supports_column_check_constraints.
Thanks maxi for the suggestion.
2014-06-16 19:25:13 -04:00
Andrew Godwin c8c79367a2 Fixed #22844: Duplicate SQL for SQLite FKs 2014-06-16 00:27:32 -07:00