Commit Graph

165 Commits

Author SHA1 Message Date
Tim Graham 78f8b80f9b Fixed schema test failure when running tests in reverse.
Follow up to 003334f8af.
2018-04-12 13:59:02 -04:00
Jeremy Bowman ee17bb8a67 Fixed #29193 -- Prevented unnecessary foreign key drops when altering a unique field.
Stopped dropping and recreating foreign key constraints on other fields
in the same table as the one which is actually being altered in an
AlterField operation.

Regression in c3e0adcad8.
2018-04-11 23:17:11 -04:00
Jeremy Bowman 003334f8af Tested altering a unique field when a reverse M2M relation exists. 2018-04-11 23:17:11 -04:00
Tim Graham 6421bd702f Refs #29227 -- Made inspectdb generate BooleanField(null=True) rather than NullBooleanField. 2018-03-20 12:10:10 -04:00
Claude Paroz 3c4ff21763 Fixed #29103 -- Removed bad 'b'-prefix added by MySQL's SchemaEditor.quote_value(). 2018-03-17 16:36:54 -04:00
Tim Graham fb8fd535c0 Moved SchemaLoggingTest to tests/schema. 2018-03-14 10:24:34 -04:00
Tim Martin 02365d3f38 Fixed #28542 -- Fixed deletion of primary key constraint if the new field is unique. 2018-01-13 20:11:55 -05:00
Tim Graham 5f456408a0 Refs #28930 -- Simplified schemas test with any(). 2018-01-02 10:11:48 -05:00
Simon Charette 9f7772e098 Fixed #28884 -- Fixed crash on SQLite when renaming a field in a model referenced by a ManyToManyField.
Introspected database constraints instead of relying on _meta.related_objects
to determine whether or not a table or a column is referenced on rename
operations.

This has the side effect of ignoring both db_constraint=False and virtual
fields such as GenericRelation which aren't backend by database level
constraints and thus shouldn't prevent the rename operations from being
performed in a transaction.

Regression in 095c1aaa89.

Thanks Tim for the additional tests and edits, and Mariusz for the review.
2017-12-22 15:19:05 -05:00
Tim Graham a862af3839
Fixed #28893 -- Removed unnecessary dict.items() calls. 2017-12-06 17:17:59 -05:00
Mariusz Felisiak fc48047586
Refs #28876 -- Fixed incorrect foreign key constraint name for models with quoted db_table.
Thanks Simon Charette and Tim Graham for the review and Carlos E. C.
Leite for the report.
2017-12-05 21:11:20 +01:00
Simon Charette 095c1aaa89 Fixed #28849 -- Fixed referenced table and column rename on SQLite.
Thanks Ramiro for the input and Tim for the review.
2017-12-01 22:12:24 -05:00
Simon Charette ee85ef8315 Fixed #28792 -- Fixed index name truncation of namespaced tables.
Refs #27458, #27843.

Thanks Tim and Mariusz for the review.
2017-11-14 21:36:25 -05:00
Tim Graham 8a1768432b Fixed #28552 -- Dropped support for MySQL 5.5. 2017-09-25 14:48:11 -04:00
Sergey Fedoseev 5b1c389603 Refs #23919 -- Replaced usage of django.utils.functional.curry() with functools.partial()/partialmethod(). 2017-09-06 13:11:18 -04:00
Claude Paroz 169c3b3e07 Fixed #14204 -- Enforced SQLite foreign key constraints.
Thanks Tim Graham for contributing to the patch and
Simon Charette for advice and review.
2017-07-11 09:07:31 -04:00
Josh Schneier fba0eaa5d6 Fixed #28298 -- Prevented a primary key alteration from adding a foreign key constraint if db_constraint=False. 2017-06-22 21:31:56 -04:00
Simon Charette b1cbbe9267 Refs #25530 -- Deleted deferred SQL references on delete operation. 2017-06-21 00:26:30 -04:00
Simon Charette b50815ee41 Refs #25530 -- Renamed deferred SQL references on rename operation. 2017-06-21 00:26:30 -04:00
Simon Charette ea91ad4c13 Refs #25530 -- Changed _create_index_name to take a table as first parameter. 2017-06-20 22:59:22 -04:00
Jon Dufresne 2c69824e5a Refs #23968 -- Removed unnecessary lists, generators, and tuple calls. 2017-06-01 19:08:59 -04:00
Mariusz Felisiak 924a89e135 Fixed #26682 -- Added support for Oracle identity columns.
Thanks Shai Berger and Tim Graham for reviews.
2017-06-01 19:33:48 +02:00
Mariusz Felisiak 663d1c3160 Simplified schema.tests with assertForeignKeyExists()/assertForeignKeyNotExists().
Thanks Tim Graham for the review.
2017-05-24 16:43:56 +02:00
Mariusz Felisiak 91b2bc3e70 Fixed #27860 -- Dropped varchar_pattern_ops/text_pattern_ops index before altering char/text field in PostgreSQL.
Thanks Tim Graham for the review.
2017-05-24 07:25:59 +02:00
Mariusz Felisiak 538bf43458 Fixed #27859 -- Ignored db_index for TextField/BinaryField on Oracle and MySQL.
Thanks Zubair Alam for the initial patch and Tim Graham for the review.
2017-05-23 17:02:40 +02:00
Tim Graham d0e43f225f Refs #28052 -- Cleaned up some indexes in schema tests. 2017-05-01 22:19:05 -04:00
Markus Holtermann 663e48947f Fixed #28052 -- Prevented dropping Meta.indexes when changing db_index to False.
Thanks Marc Tamlyn for the report and Ian Foote/Tim Graham for review.
2017-05-01 11:31:48 -04:00
Simon Charette 35c0025151 Fixed #27928 -- Avoided SET/DROP DEFAULT unless a field changes from null to non-null.
Thanks Christophe Pettus, Matteo Pietro Russo for reports and Tim for review.
2017-04-02 16:34:03 -04:00
Vytis Banaitis 8838d4dd49 Refs #23919 -- Replaced kwargs.pop() with keyword-only arguments. 2017-02-01 11:41:56 -05:00
Tim Graham 0de0699d94 Fixed #27788 -- Dropped support for Oracle < 12.1. 2017-01-28 08:19:47 -05:00
chillaranand d6eaf7c018 Refs #23919 -- Replaced super(ClassName, self) with super(). 2017-01-25 12:23:46 -05:00
Tim Graham 7aba69145d Refs #23919 -- Removed django.test.mock Python 2 compatibility shim. 2017-01-20 08:17:20 -05:00
Claude Paroz f3c43ad1fd Refs #23919 -- Removed python_2_unicode_compatible decorator usage 2017-01-18 13:44:34 +01:00
Andrew Nester 69b7d4b116 Fixed #27458 -- Fixed invalid sequence/index names when using "USER"."TABLE" db_table on Oracle. 2016-12-30 17:11:12 -05:00
Simon Charette 813805833a Fixed #27631 -- Prevented execution of transactional DDL statements when unsupported.
Executing a DDL statement during a transaction on backends that don't support
it silently commits, leaving atomic() in an incoherent state.

While schema_editor.execute() could technically be used to execute DML
statements such usage should be uncommon as these are usually performed through
the ORM. In other cases schema_editor.connection.execute() can be used to
circumvent this check.

Thanks Adam and Tim for the review.
2016-12-28 19:43:32 -05:00
Simon Charette cd7efa2033 Fixed #25492 -- Checked deferred foreign key constraints before dropping them.
This allows running foreign key data and schema altering operations in the
same migration on PostgreSQL.

Thanks Tim for review.
2016-12-24 13:53:11 -05:00
Simon Charette 96181080ba Refs #26384 -- Isolated a test model in schema tests. 2016-12-23 21:43:49 -05:00
za 321e94fa41 Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings. 2016-11-10 21:30:21 -05:00
Tim Graham 414ad25b09 Fixed #27327 -- Simplified time zone handling by requiring pytz. 2016-10-27 08:53:20 -04:00
Claude Paroz d389125606 Fixed #27098 -- Deprecated DatabaseIntrospection.get_indexes
Thanks Akshesh <aksheshdoshi@gmail.com> for help with the PostgreSQL query.
Thanks Tim Graham for the review.
2016-09-12 09:26:33 +02:00
Simon Charette aca939b6e5 Fixed #27195 -- Stopped dropping default when adding a nullable column.
Thanks Rob Golding from Zapier for the report.
2016-09-09 00:48:50 -04:00
Akshesh 6e07ec3f65 Fixed #27030 -- Added contrib.postgres.indexes.GinIndex. 2016-08-12 18:37:03 -04:00
Akshesh 311a8e8d50 Fixed #20888 -- Added support for column order in class-based indexes. 2016-08-12 15:52:16 -04:00
Akshesh 324c1b432a Fixed #24442 -- Improved SchemaEditor's index name truncation. 2016-08-11 14:36:31 -04:00
Jon Dufresne 2e4cfcd2b9 Fixed #26889 -- Fixed missing PostgreSQL index in SchemaEditor.add_field(). 2016-07-13 14:33:54 -07:00
Jon Dufresne e9e705eedc Added strict=True to all SchemaEditor.alter_field() calls in tests.
It should help catch bugs.
2016-07-08 12:03:33 -04:00
Jon Dufresne 9356f63a99 Fixed #25317, #26090 -- Fixed swapping combinations of unique and db_index during migrations. 2016-07-07 20:29:08 -04:00
Akshesh 52442898e7 Refs #26709 -- Added 'model' argument to SchemaEditor.add/remove_index()
This removes the dependency of the Index class on its model attribute
when a name is passed to it.

Thanks to Markush for discussions.
2016-07-07 10:06:55 -04:00
Jon Dufresne 3410820460 Fixed #26833 -- Fixed SchemaEditor._constraint_names() to handle features.uppercases_column_names. 2016-07-07 08:09:42 -04:00
Jon Dufresne 16614dcd5c Fixed #25694 -- Removed incorrect _uniq suffix on index names during migrations. 2016-06-29 14:47:29 -04:00