Commit Graph

412 Commits

Author SHA1 Message Date
Tyson Clugg e34226fc37 Fixed #25259 -- Added comments to header of generated migration files 2015-08-31 22:14:21 +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
Caio Ariede de41fbb3cf Fixed #25239 -- Corrected makemigrations numbering if a migration has a number-only filename. 2015-08-14 07:28:37 -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
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
Markus Holtermann 736fb1838c Used field.clone() where applicable 2015-06-28 15:11:26 +02:00
Tim Graham 7da3923ba0 Sorted imports in __init__.py files. 2015-06-27 11:53:33 -04:00
Markus Holtermann c5eca74619 Sorted reduce methods in migration optimizer
Thanks Tim Graham for the review.
2015-06-16 00:46:04 +02: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
Tim Graham 3872a33132 Fixed #24979 -- Removed usage of inspect.getargspec(). 2015-06-15 13:43:22 -04:00
Tim Graham 4b600ed244 Removed django.utils.functional.total_ordering() 2015-06-15 13:15:24 -04:00
Markus Holtermann 432623603c Changed reduce method lookup in migration optimizer to dict
Thanks Andrew Godwin and Simon Charette for the review.
2015-06-14 20:44:22 +02:00
Markus Holtermann 4a7d374fd5 Explicitly imported migration operations in optimizer
Thanks Andrew Godwin for the review.
2015-06-14 20:34:54 +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
Steadman ed63df3fc2 Fixed #24899 -- Split migrations autodetector._detect_changes() method 2015-06-04 22:35:33 -04: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 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
Piotr Jakimiak 4157c502a5 Removed unnecessary arguments in .get method calls 2015-05-13 20:51:18 +02:00
Claude Paroz f61c4f490d Fixed #24742 -- Made runserver.check_migrations ignore read-only databases
Thanks Luis Del Giudice for the report, and Aymeric Augustin and Markus
Holtermann for the reviews.
2015-05-13 18:30:36 +02:00
Luis Del Giudice 69ddc1b3da Fixed #24693 -- Added label and label_lower property to Model._meta 2015-05-02 16:58:18 +02: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
Matthew Wilkes e4b7daec11 Refs #24354 -- Prevented repointing of relations on superclasses when migrating a subclass's name change
The issue was hidden on 1.8+ until #24573 due to a bug inside the model
reloading process.

Forwardport of patch from ae87ad005f
2015-04-21 11:28:38 +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 8097e54832 Fixed #23879 -- Allowed model migration skip based on feature/vendor
Thanks Carl Meyer for the report and review, and Tim Graham for the
review.
2015-04-18 15:17:49 +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
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
Markus Holtermann 3e7d9d05ac Refs #24554 -- Prevented rendering of unused migrations
Thanks Claude Paroz and Tim Graham for the review
2015-04-01 02:00:34 +02:00
Markus Holtermann 57dc8dd3fa Fixed #24554 -- Sped up migrations by rendering initial apps when they are first needed
Calling Migration.mutate_state() now also allows to do in_place
mutations in case an intermediate state is thrown away later.

Thanks Anssi Kääriäinen for the idea, Ryan Hall for parts of the patch,
and Claude Paroz and Tim Graham for the review
2015-04-01 02:00:05 +02:00
Markus Holtermann c5cc332bf2 Fixed #24550 -- Added migration operation description to sqlmigrate output
Thanks Tim Graham for the review.
2015-03-30 16:31:20 +02:00
Marten Kenbeek 75430be86f Refs #24366 -- Fixed recursion depth error in migration graph
Made MigrationGraph forwards_plan() and backwards_plan() fall back to an
iterative approach in case the recursive approach exceeds the recursion
depth limit.
2015-03-29 16:08:07 +02:00
Marten Kenbeek bc83add04c Refs #24366 -- Renamed arguments in MigrationGraph, renamed tests 2015-03-29 16:07:58 +02:00
Markus Holtermann c7ec3c07e7 Fixed #24537 -- Ignored field order in RenameModel detection
Thanks to David Sanders for the report and test and Simon Charette for
the review.
2015-03-28 20:45:15 +01:00
Alex Hill 7a75ed1a4f Removed untouched branch in StateApps.__init__() 2015-03-25 16:48:26 -04:00