Commit Graph

596 Commits

Author SHA1 Message Date
Calvin DeBoer 058d33f3ed Fixed #29198 -- Added migrate --plan option. 2018-08-03 15:22:42 -04:00
Tim Graham c72dde41e6 Fixed #29595 -- Allowed using timedelta in migrations questioner.
Refs #29600 -- Removed usage of django.utils.datetime_safe in migrations.
2018-07-27 11:53:49 -04:00
Simon Charette dc1dcad0f5 Refs #24424 -- Added regression tests for MTI-inheritance model removal.
The issue was fixed as a side effect of implementing RemoveField's reduction
of DeleteModel to a DeleteModel in ad82900ad9.
2018-07-25 12:07:41 -04:00
Mariusz Felisiak 5a017eef4c
Fixed test_migrate_syncdb_deferred_sql_executed_with_schemaeditor() on Oracle. 2018-07-22 08:47:55 +02:00
Tim Graham 8d4ab0c41f
Added tests for migrate logging and error messages. 2018-07-20 20:37:52 -04:00
Simon Charette 8e3f22f251 Fixed #27731 -- Implemented CreateModel/AlterFooOperation reduction.
This should alleviate the side effects of disabling the AlterFooOperation
reduction with RemoveField to fix refs #28862 during migration squashing
because CreateModel can perform a reduction with RemoveField.

Thanks Nick Pope for the review.
2018-07-19 17:06:01 -04:00
Simon Charette ed7898e1b5 Fixed #28862 -- Disabled optimization of AlterFooTogether and RemoveField.
AlterFooTogether operations cannot be swapped with RemoveField operations on
the same model as they could be removing the the same field as well.

Since AlterFooTogether operations don't track what their previous value was,
it's impossible to determine whether or not the optimization is safe so the
only way to proceed is to disable the optimization.

Thanks Ramiro Morales for the in-depth analysis of the issue.

Refs #24828
2018-07-19 17:06:01 -04:00
Simon Charette 37cafbfb79 Fixed #27845 -- Allowed both right and left optimizations of operations.
Thanks Raphael Gaschignard for the suggestion.
2018-07-11 10:49:50 -04:00
Simon Charette 0025dd5eb4 Allowed RemoveField operations to be optimized through. 2018-07-11 10:49:50 -04:00
Simon Charette 50b8c98a0f Relaxed FieldOperation.references_field remote field checking. 2018-07-11 10:49:50 -04:00
Simon Charette ad82900ad9 Fixed #26720 -- Prevented invalid CreateModel optimizations of related fields. 2018-07-11 10:49:50 -04:00
Simon Charette a97845a823 Fixed #27768 -- Allowed migration optimization of CreateModel order.
Thanks Ed Morley from Mozilla for the tests.
2018-07-11 10:49:50 -04:00
Simon Charette d3a935f01f Refs #27768 -- Reversed order of optimized and in-between operations.
Operations can only be optimized through if they don't reference any of the
state the operation they are compared against defines or alters, so it's
safe to reverse the order.
2018-07-11 10:49:50 -04:00
Simon Charette e4c0878b30 Refs #22875 -- Fixed an optimizer test to use a valid scenario.
An explicit intermediary many-to-many relationship must declare forward and
reverse foreign keys. The original issue was in the autodetector as these
operations shouldn't have been generated in this order in the first place
which is tested by AutodetectorTests.test_create_with_through_model.
2018-07-10 16:47:57 -04:00
Ian Foote 952f05a6db Fixed #11964 -- Added support for database check constraints. 2018-07-10 15:32:33 -04:00
Sergey Fedoseev 338f741c5e Fixed #29546 -- Deprecated django.utils.timezone.FixedOffset. 2018-07-09 16:33:36 -04:00
oliver 6b3e17bab6 Fixed #29518 -- Added validation for sqlmigrate's app_label argument. 2018-06-25 10:43:12 -04:00
Claude Paroz fc26615164 Refs #29506 -- Added validation for squashmigrations' app_label option. 2018-06-20 15:46:43 -04:00
Claude Paroz c723a1ff8e Fixed #29506 -- Added validation for migrate's app_label option.
Thanks MyungSeKyo for the report and the initial patch.
2018-06-20 15:42:40 -04:00
Claude Paroz c3c7d15c34 Refs #29469 -- Reused get_app_config() error message in makemigrations error. 2018-06-20 15:41:51 -04:00
Claude Paroz abbc9cd71c Moved makemigrations app_label validation tests. 2018-06-20 15:33:23 -04:00
oliver 78972af367 Fixed #29469 -- Added a helpful makemigrations error if app_label contains dots. 2018-06-16 15:18:57 -04:00
Tim Graham 63f90f55f3 Fixed #29498 -- Fixed a missing pyc test file in source distribution. 2018-06-15 14:18:08 -04:00
Jeff fcc4e251db Fixed #29000 -- Fixed RenameModel's renaming of a M2M column when run after RenameField.
Regression in 45ded053b1.
2018-06-15 11:51:09 -04:00
Morgan Aubert 704443acac Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage(). 2018-05-09 11:40:28 -04:00
Sanket Saurav 079f324357 Fixed #28913 -- Fixed error handling when MIGRATIONS_MODULES specifies a nonexistent top-level package. 2018-05-05 18:26:33 -04:00
Jon Dufresne f3b1c3bd06 Refs #23406 -- Fixed "invalid escape sequence" warning in migrations test. 2018-04-02 22:54:05 -04:00
Simon Charette 2156565b5b Fixed #29245 -- Made autodetector treat field renames + db_column addition as RenameField. 2018-03-28 12:43:43 -04:00
Dan Watson 29150d5da8 Fixed #23406 -- Allowed migrations to be loaded from .pyc files. 2018-03-23 13:20:38 -04:00
Mariusz Felisiak 362813d628
Fixed hanging indentation in various code. 2018-03-16 10:54:34 +01:00
Carlton Gibson 5b083a824e Fixed #29180 -- Fixed a regression where migrations already in the plan were readded.
Regression in a38ae914d8.
2018-03-09 08:59:57 +01:00
Tim Graham 0a37ea56d0 Fixed #29091 -- Fixed makemigrations crash if migrations directory doesn't have __init__.py.
Regression in aadd3aeb2b.
2018-01-31 09:36:36 -05:00
Simon Charette dcdd219ee1 Fixed #25817 -- Made RenameField repoint to_field/to_fields references.
Also updated the autodetector to assume the RenameField operation will
perform the required repointing.
2017-12-30 14:59:22 -05:00
Mariusz Felisiak 83a36ac49a
Removed unnecessary trailing commas and spaces in various code. 2017-12-28 21:07:29 +01: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
Sergey Fedoseev 183fb7b2b9 Fixed #28870 -- Added support for functools.partialmethod serialization in migrations. 2017-12-06 14:49:37 -05:00
Дилян Палаузов d2afa5eb23 Fixed #28860 -- Removed unnecessary len() calls. 2017-12-04 10:35:23 -05: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
Tim Graham c3e0adcad8 Fixed #28305 -- Fixed "Cannot change column 'x': used in a foreign key constraint" crash on MySQL with a sequence of AlterField or RenameField operations.
Regression in 45ded053b1.
2017-12-01 19:07:46 -05:00
Дилян Палаузов 6c0042430e Fixed #28776 -- Fixed a/an/and typos in docs and comments. 2017-11-06 22:41:03 -05:00
Tim Graham 941b0a5b33 Fixed #28708 -- Added constants to detect the Python version. 2017-10-13 10:11:15 -04:00
Jeremy Satterfield 0891503fad Fixed #28493 -- Made migrations autodetector find dependencies for model renaming. 2017-09-04 15:15:39 -04:00
Evan Grim 7937cc16f5 Fixed #28386 -- Made operations within non-atomic migrations honor the operation's atomic flag when migrating backwards. 2017-08-10 19:21:14 -04:00
Evan Grim 5893eaddf4 Added missing test for RunPython behavior when unapplying. 2017-08-10 19:19:48 -04:00
Mads Jensen a51c4de194 Used assertRaisesMessage() to test Django's error messages. 2017-07-29 19:07:23 -04:00
Melvyn Sopacua 5bb9b9a388 Fixed #28363 -- Allowed naming the migration generated by squashmigrations. 2017-07-26 13:47:35 -04:00
Simon Charette 5cbcb36839 Fixed #28350 -- Fixed UnboundLocalError crash in RenameField with nonexistent field.
Thanks Tim for the review.
2017-06-30 12:50:37 -04:00
Mariusz Felisiak 081e787160 Refs #23919 -- Stopped inheriting from object to define new style classes.
Tests and docs complement to cecc079168.
2017-06-26 10:30:31 -04:00
Marti Raudsepp fda55c71a8 Fixed #27858 -- Prevented read-only management commands from creating the django_migrations table.
MigrationRecorder now assumes that if the django_migrations table
doesn't exist, then no migrations are applied.

Reverted documentation change from refs #23808.
2017-06-19 13:04:57 -04:00
Jon Dufresne 2c69824e5a Refs #23968 -- Removed unnecessary lists, generators, and tuple calls. 2017-06-01 19:08:59 -04:00