summaryrefslogtreecommitdiff
path: root/django/db/migrations
AgeCommit message (Collapse)Author
2015-04-30Fixed #24725 -- Allowed renaming of target models in ManyToMany relationsMarkus Holtermann
This is a regression caused by introducing rendered migration states in 1aa3e09c2043 and the _meta refactoring in fb48eb05816b. 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-25Fixed #24701 -- Converted model manager names to unicode in migrationsMarkus Holtermann
Thanks to Reto Aebersold for reporting the issue and Tim Graham and Claude Paroz for the review.
2015-04-21Fixed #24573 -- Considered new related models for reloadingMarkus Holtermann
Thanks tttomekkk for the report.
2015-04-21Refs #24354 -- Prevented repointing of relations on superclasses when ↵Matthew Wilkes
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 ae87ad005f7b62f5fa5a29ef07443fa1bbb9baf0
2015-04-20Fixed #24591 -- Optimized cloning of ModelState objects.Marten Kenbeek
Changed ModelState.clone() to create a shallow copy of self.fields and self.managers.
2015-04-20Refs #24397 -- Sped up model reloading in ProjectState.Marten Kenbeek
Created bulk_update() context manager on StateApps. Sped up unregistering models in reload_models() by using this context mananger.
2015-04-18Fixed #23879 -- Allowed model migration skip based on feature/vendorClaude Paroz
Thanks Carl Meyer for the report and review, and Tim Graham for the review.
2015-04-10Fixed #24514 -- Made migration writer omit models import if it's unused.Christopher Luc
2015-04-07Fixed #24513 -- Made sure a model is only rendered once during reloadsPatryk Zawadzki
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-05Fixed #24278 -- Fixed serialization of migration operations.Marten Kenbeek
Fixed MigrationWriter.serialize() to correctly handle migration operations by utilizing OperationWriter. Thanks Piotr Maliński for the report.
2015-04-05Refs #24278 -- Allowed multi-line serializations in OperationWriter.Marten Kenbeek
Changed OperationWriter to support multi-line serialized values with correct indentation.
2015-04-02Fixed #24566 -- Added support for serializing timedeltaBaptiste Mispelon
Thanks to knbk for the report.
2015-04-01Refs #24554 -- Prevented rendering of unused migrationsMarkus Holtermann
Thanks Claude Paroz and Tim Graham for the review
2015-04-01Fixed #24554 -- Sped up migrations by rendering initial apps when they are ↵Markus Holtermann
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-03-30Fixed #24550 -- Added migration operation description to sqlmigrate outputMarkus Holtermann
Thanks Tim Graham for the review.
2015-03-29Refs #24366 -- Fixed recursion depth error in migration graphMarten Kenbeek
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-29Refs #24366 -- Renamed arguments in MigrationGraph, renamed testsMarten Kenbeek
2015-03-28Fixed #24537 -- Ignored field order in RenameModel detectionMarkus Holtermann
Thanks to David Sanders for the report and test and Simon Charette for the review.
2015-03-25Removed untouched branch in StateApps.__init__()Alex Hill
2015-03-25Fixed #24215 -- Refactored lazy model operationsAlex Hill
This adds a new method, Apps.lazy_model_operation(), and a helper function, lazy_related_operation(), which together supersede add_lazy_relation() and make lazy model operations the responsibility of the App registry. This system no longer uses the class_prepared signal.
2015-03-25Renamed Field.rel attribute to remote_fieldAnssi Kääriäinen
Field.rel is now deprecated. Rel objects have now also remote_field attribute. This means that self == self.remote_field.remote_field. In addition, made the Rel objects a bit more like Field objects. Still, marked ManyToManyFields as null=True.
2015-03-23Fixed #24521 -- Added support for serializing frozensets in migrations.Baptiste Mispelon
2015-03-08Fixed #23407 -- Extended coverage of makemigrations --noinput option.Marten Kenbeek
Changed --noinput option in makemigrations to suppress all user prompts, not just when combined with --merge.
2015-03-08Fixed #24397 -- Sped up rendering multiple model states.Marten Kenbeek
Set apps.ready to False when rendering multiple models. This prevents that the cache on Model._meta is expired on all models after each time a single model is rendered. Prevented that Apps.clear_cache() refills the cache on Apps.get_models(), so that the wrong value cannot be cached when cloning a StateApps.
2015-03-04Fixed #24435 -- Prevented m2m field removal and addition in migrations when ↵Markus Holtermann
changing blank Thanks Mark Tranchant for the report an Tim Graham for the test and review.
2015-02-23Prevented makemigrations from writing in sys.path[0].Aymeric Augustin
There's no reason to assume that sys.path[0] is an appropriate location for generating code. Specifically that doesn't work with extend_sys_path which puts the additional directories at the end of sys.path. In order to create a new migrations module, instead of using an arbitrary entry from sys.path, import as much as possible from the path to the module, then create missing submodules from there. Without this change, the tests introduced in the following commit fail, which seems sufficient to prevent regressions for such a refactoring.
2015-02-23Fixed #24366 -- Optimized traversal of large migration dependency graphs.Marten Kenbeek
Switched from an adjancency list and uncached, iterative depth-first search to a Node-based design with direct parent/child links and a cached, recursive depth-first search. With this change, calculating a migration plan for a large graph takes several seconds instead of several hours. Marked test `migrations.test_graph.GraphTests.test_dfs` as an expected failure due to reaching the maximum recursion depth.
2015-02-20Fixed #24351, #24346 -- Changed the signature of allow_migrate().Loic Bistuer
The new signature enables better support for routing RunPython and RunSQL operations, especially w.r.t. reusable and third-party apps. This commit also takes advantage of the deprecation cycle for the old signature to remove the backward incompatibility introduced in #22583; RunPython and RunSQL won't call allow_migrate() when when the router has the old signature. Thanks Aymeric Augustin and Tim Graham for helping shape up the patch. Refs 22583.
2015-02-18Fixed #24291 - Fixed migration ModelState generation with unused swappable ↵Marten Kenbeek
models Swapped out models don't have a _default_manager unless they have explicitly defined managers. ModelState.from_model() now accounts for this case and uses an empty list for managers if no explicit managers are defined and a model is swapped out.
2015-02-17Refs #24324 -- Fixed UnicodeDecodeError in MigrationWriter on Python 2.Tim Graham
2015-02-17Refs #24324 -- Fixed UnicodeDecodeError in makemigrations.Tim Graham
If the project path contained a non-ASCII character, Python 2 crashed.
2015-02-16Fixed #24225, #24264, #24282 -- Rewrote model reloading in migration project ↵Markus Holtermann
state Instead of naively reloading only directly related models (FK, O2O, M2M relationship) the project state needs to reload their relations as well as the model changes as well. Furthermore inheriting models (and super models) need to be reloaded in order to keep inherited fields in sync. To prevent endless recursive calls an iterative approach is taken.
2015-02-13Fixed #24184 -- Prevented automatic soft-apply of migrationsMarkus Holtermann
Previously Django only checked for the table name in CreateModel operations in initial migrations and faked the migration automatically. This led to various errors and unexpected behavior. The newly introduced --fake-initial flag to the migrate command must be passed to get the same behavior again. With this change Django will bail out in with a "duplicate relation / table" error instead. Thanks Carl Meyer and Tim Graham for the documentation update, report and review.
2015-02-07Revert "Fixed #24075 -- Prevented running post_migrate signals when ↵Markus Holtermann
unapplying initial migrations of contenttypes and auth" This reverts commit 737d24923ac69bb8b89af1bb2f3f4c4c744349e8.
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2015-01-20Fixed typos in code comments.Adam Taylor
2015-01-20Fixed #24155 -- Maintained kwargs and import order in migration writerMarkus Holtermann
Thanks Tomas Dobrovolny for the report and Tim Graham for the review.
2015-01-17Removed the syncdb command per deprecation timeline.Tim Graham
2015-01-15Fixed #24135 -- Made RenameModel rename many-to-many tables.Tim Graham
Thanks Simon and Markus for reviews.
2015-01-14Fixed #24075 -- Prevented running post_migrate signals when unapplying ↵Markus Holtermann
initial migrations of contenttypes and auth Thanks Florian Apolloner for the report and Claude Paroz and Tim Graham for the review and help on the patch.
2015-01-14Fixed #24147 -- Prevented managers leaking model during migrationsMarkus Holtermann
Thanks Tim Graham for the review.
2015-01-12Fixed #24129 -- Added indicator that migrations are rendering the initial stateMarkus Holtermann
Thanks Tim Graham for the review.
2015-01-12Fixed #24123 -- Used all available migrations to generate the initial ↵Markus Holtermann
migration state Thanks Collin Anderson for the input when creating the patch and Tim Graham for the review.
2015-01-11Refs #24110 -- Added a more descriptive release note and fixed a spelling ↵Markus Holtermann
mistake.
2015-01-10Fixed #24110 -- Rewrote migration unapply to preserve intermediate statesMarkus Holtermann
2015-01-10Fixed #22583 -- Allowed RunPython and RunSQL to provide hints to the db router.Loic Bistuer
Thanks Markus Holtermann and Tim Graham for the review.
2015-01-09Fixed #24098 -- Added no-op attributes to RunPython and RunSQLMarkus Holtermann
Thanks Loïc Bistuer and Tim Graham for the discussion and review.
2015-01-07Fixed #24093 -- Prevented MigrationWriter to write operation kwargs that are ↵Markus Holtermann
not explicitly deconstructed
2015-01-07Refs #23822 -- Made MigrationOptimizer aware of model managersMarkus Holtermann
2015-01-07Refs #22608 -- Optimized migration optimizerMarkus Holtermann
Moved list constants instantiation into optimizer's __init__.