Commit Graph

421 Commits

Author SHA1 Message Date
Markus Holtermann 43f2eb7ef3 Fixed #25390 -- Allowed specifying a start migration in squashmigrations
Thanks Tim Graham for the review.
2015-09-19 14:55:34 +10:00
Markus Holtermann 5aa55038ca Fixed #24743, #24745 -- Optimized migration plan handling
The change partly goes back to the old behavior for forwards migrations
which should reduce the amount of memory consumption (#24745). However,
by the way the current state computation is done (there is no
`state_backwards` on a migration class) this change cannot be applied to
backwards migrations. Hence rolling back migrations still requires the
precomputation and storage of the intermediate migration states.

This improvement also implies that Django does not handle mixed
migration plans anymore. Mixed plans consist of a list of migrations
where some are being applied and others are being unapplied.

Thanks Andrew Godwin, Josh Smeaton and Tim Graham for the review as well
as everybody involved on the ticket that kept me looking into the issue.
2015-09-19 14:54:53 +10:00
Dražen Odobašić b1e33ceced Fixed #23395 -- Limited line lengths to 119 characters. 2015-09-12 11:40:50 -04:00
Markus Holtermann f45ee19746 Refs #24919 -- Raised more helpful error message for disabled migrations 2015-09-12 10:38:15 +10:00
Markus Holtermann a3c01b0dd8 Fixed #24919 -- Allowed disabling of migrations on a per app basis 2015-09-12 10:38:15 +10:00
Alex Hill 25c157e4cc Refs #24215 -- Improved error message for unhandled lazy model operations. 2015-09-07 20:31:58 -04:00
Tyson Clugg e34226fc37 Fixed #25259 -- Added comments to header of generated migration files 2015-08-31 22:14:21 +10:00
Markus Holtermann 8e631a3175 Refs #24590 -- Ensured isolation between autodetector tests
Fixed a regression introduced in e1427cc609 when running tests in reverse order.
2015-08-28 10:17:34 +10:00
Markus Holtermann 91f701f4fc Fixed #25280 -- Properly checked regex objects for equality to prevent infinite migrations
Thanks Sayid Munawar and Tim Graham for the report, investigation and
review.
2015-08-27 09:52:53 +10:00
Jeremy Satterfield 1175027641 Fixed #25308 -- Made MigrationQuestioner respect MIGRATION_MODULES setting. 2015-08-26 09:04:00 -04:00
Tim Graham 01966bb2a7 Fixed typo in tests/migrations/test_autodetector.py. 2015-08-20 14:52:26 -04:00
Markus Holtermann 0271a11ba5 Fixed #24755 -- Hid operations from dependency apps when merging migrations
Thanks Carl Meyer for the report and Tim Graham for the review.
2015-08-18 18:33:14 +10:00
Caio Ariede de41fbb3cf Fixed #25239 -- Corrected makemigrations numbering if a migration has a number-only filename. 2015-08-14 07:28:37 -04:00
Simon Charette 12f91f6ebd Used skipUnlessDBFeature where appropriate. 2015-08-08 11:27:06 -04:00
mlavin 69db1c7455 Fixed #25231 -- Added recording of squashed migrations in the migrate command.
Ensured squashed migrations are recorded as applied when the
migrate command is run and all of the original migrations
have been previously applied.
2015-08-07 17:59:18 -04:00
Piper Merriam 537818af87 Fixed #25185 -- Added support for functools.partial serialization in migrations 2015-07-29 10:15:50 -04:00
Piper Merriam b1e552debf Fixed #25186 -- Improved migration's serialization of builtins on Python 2. 2015-07-28 18:15:01 -04:00
Flavio Curella c2e70f0265 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 2015-07-27 18:28:13 -04:00
Andrei Kulakov db97a88495 Fixed #24375 -- Added Migration.initial attribute
The new attribute is checked when the `migrate --fake-initial` option
is used. initial will be set to True for all initial migrations (this
is particularly useful when initial migrations are split) as well as
for squashed migrations.
2015-07-13 15:57:40 -04:00
Kai Richard Koenig 60f795c060 Fixed #25040 -- Fixed migrations state crash with GenericForeignKey 2015-07-02 12:48:29 -04:00
Andriy Sokolovskiy c0cf73a57d Refs #20203 -- Allowed adding custom default manager to the model state
If the only manager on the model is the default manager defined
by Django (`objects = models.Manager()`), this manager will not
be added to the model state. If it is custom, it needs to be
passed to the model state.
2015-06-29 21:15:37 -04:00
Tim Graham aaacaeb096 Renamed RemovedInDjangoXYWarnings for new roadmap.
Forwardport of ae1d663b79
from stable/1.8.x plus more.
2015-06-24 16:08:20 -04:00
Markus Holtermann 7bb7670ee4 Used mock in MigrationQuestioner tests
Thanks Andriy Sokolovskiy and Simon Charette for the review.
2015-06-23 17:34:22 +02:00
Tim Graham 7f1168e387 Removed support for Python 3.3. 2015-06-18 08:36:50 -04:00
Markus Holtermann e470f311d6 Fixed #24828 -- Allowed migration optimization across AlterFooTogether
The idea behind this change is, that AlterUniqueTogether,
AlterIndexTogether and AlterOrderWithRespectTo can always be moved after
an Add/Alter/Rename/RemoveField operation if they don't refer to the
respective field and are not empty sets / None.

Combined with the optimizations of duplicate AlterUniqueTogether,
AlterIndexTogether, and AlterOrderWithRespectTo operations from
128caa1e16, these operations are optimized
in a later round of the optimizer.

Thanks Tim Graham for the review.
2015-06-16 00:43:22 +02:00
Markus Holtermann 128caa1e16 Optimized duplicate AlterModelTable/AlterFooTogether/AlterOWRT
Thanks Andrew Godwin for the review.
2015-06-14 20:34:48 +02:00
Markus Holtermann 5bc412c35a Took AlterOrderWithRespectTo into account when optimizing migrations
Thanks Andrew Godwin for the review.
2015-06-14 20:34:34 +02:00
Carl Meyer 57dbc87ade Cleaned up docstring style, per Tim Graham review. 2015-06-03 19:20:12 -06:00
Carl Meyer 5c085ea7b3 Refs #24628 -- Added a second test and a docstring comment to avoid regression. 2015-06-03 13:46:01 -06:00
Carl Meyer 492537ac18 Fixed #24628 -- Fixed applied status for squashed migrations. 2015-06-02 16:15:13 -06:00
Carl Meyer 335fc44f68 Improved isolation of applied-migrations table in migration tests. 2015-06-02 16:14:02 -06:00
Carl Meyer 84522c0d16 Fixed #24895 -- Fixed loading a pair of squashed migrations with a dependency. 2015-06-02 12:07:54 -06:00
Yoong Kang Lim 076a63e672 Fixed #24883 -- Added MigrationGraph.__repr__() 2015-06-01 10:45:52 -04:00
Matt Westcott ff8a02ae0b Fixed #24340 -- Added nested deconstruction for list, tuple and dict values
Nested deconstruction should recursively deconstruct items within list,
tuple and dict values.
2015-05-26 17:10:02 +02:00
Marten Kenbeek d73176a842 Fixed #24848 -- Fixed ValueError for faulty migrations module.
Added apps to unmigrated apps if the migrations module is a file
or a folder missing __init__.py.

Thanks to Ernest0x for the bug report.
2015-05-25 13:47:50 -04:00
Simon Charette be67400b47 Refs #24652 -- Used SimpleTestCase where appropriate. 2015-05-20 13:46:13 -04:00
Tim Graham f5da438072 Fixed #24812 -- Fixed app registry RuntimeWarnings in schema and migrations tests. 2015-05-18 09:48:25 -04:00
Markus Holtermann 811d7870a5 Moved migration exception classes to shared module
Thanks Aymeric Augustin for the review.
2015-05-02 12:54:44 +02:00
Markus Holtermann 63f9b633f9 Fixed #24725 -- Allowed renaming of target models in ManyToMany relations
This is a regression caused by introducing rendered migration states in
1aa3e09c20 and the _meta refactoring in fb48eb0581.

Thanks to Danilo Bargen for reporting the issue and Marten Kenbeek and
Tim Graham for triaging the bug and providing the initial test case.
2015-04-30 13:27:29 +02:00
Markus Holtermann faad6070ee Fixed #24701 -- Converted model manager names to unicode in migrations
Thanks to Reto Aebersold for reporting the issue and Tim Graham and
Claude Paroz for the review.
2015-04-25 18:17:06 +02:00
Markus Holtermann b93690c465 Fixed #24573 -- Considered new related models for reloading
Thanks tttomekkk for the report.
2015-04-21 11:35:45 +02:00
Marten Kenbeek 1a1f16d67d Fixed #24591 -- Optimized cloning of ModelState objects.
Changed ModelState.clone() to create a shallow copy of self.fields
and self.managers.
2015-04-20 19:53:21 -04:00
Marten Kenbeek 039d7881b4 Refs #24397 -- Sped up model reloading in ProjectState.
Created bulk_update() context manager on StateApps. Sped up unregistering
models in reload_models() by using this context mananger.
2015-04-20 14:42:23 -04:00
Claude Paroz 02260ea3f6 Fixed #24595 -- Prevented loss of null info in MySQL field alteration
Thanks Simon Percivall for the report, and Simon Charette and Tim
Graham for the reviews.
2015-04-17 10:25:15 +02:00
Christopher Luc a7bc00e17b Fixed #24514 -- Made migration writer omit models import if it's unused. 2015-04-10 07:04:26 -04:00
Curtis Maloney 88d7fcebde Use mock.patch in migrations tests
Currently some of the migrations tests rely on the fact 'input' is aliased
because of six, instead of using mock.patch.  Replace this code with proper
use of mock.patch.

Also, replace one case of excessively specific python version check with
testing six.PY3
2015-04-09 11:16:12 +10:00
Patryk Zawadzki 0385dad073 Fixed #24513 -- Made sure a model is only rendered once during reloads
This also prevents state modifications from corrupting previous states.
Previously, when a model defining a relation was unregistered first,
clearing the cache would cause its related models' _meta to be cleared
and would result in the old models losing track of their relations.
2015-04-07 14:49:47 +02:00
Marten Kenbeek e8e4f978dd Fixed #24278 -- Fixed serialization of migration operations.
Fixed MigrationWriter.serialize() to correctly handle migration
operations by utilizing OperationWriter.

Thanks Piotr Maliński for the report.
2015-04-05 20:26:21 +02:00
Marten Kenbeek d597174bd4 Refs #24278 -- Allowed multi-line serializations in OperationWriter.
Changed OperationWriter to support multi-line serialized values with
correct indentation.
2015-04-05 20:19:24 +02:00
Baptiste Mispelon 30a3c2f74c Fixed #24566 -- Added support for serializing timedelta
Thanks to knbk for the report.
2015-04-02 17:21:20 +02:00