Commit Graph

487 Commits

Author SHA1 Message Date
Claude Paroz 2ced2f785d Replaced smart_* by force_* calls whenever possible
The smart_* version should only be used when a lazy string should keep
its lazy status.
2016-09-03 13:46:41 +02:00
Tim Graham 098c07a032 Fixed #27142, #27110 -- Made makemigrations consistency checks respect database routers.
Partially reverted refs #27054 except for one of the tests as this
solution supersedes that one.

Thanks Shai Berger for the review.
2016-09-01 16:19:29 -04:00
Tim Graham 96ee486ea4 Fixed #27081 -- Allowed migrations to serialize methods on pypy. 2016-08-30 21:47:34 -04:00
Simon Charette 0d7929266e Fixed #25109 -- Stopped silencing explicitly specified migration modules import errors.
Thanks Tim for the review.
2016-08-30 19:50:42 -04:00
Pavel Sutyrin 3fe92f4477 Clarified topological_sort_as_sets() docstring. 2016-08-29 13:58:39 -04:00
Simon Charette d5c4ea5246 Fixed #27100 -- Included already applied migration changes in the pre-migrate state.
Refs #24100.

Thanks Tim for the review.
2016-08-24 01:17:48 -04:00
Simon Charette d1757d8df4 Fixed #27044 -- Included already applied migration changes in the post-migrate state when the execution plan is empty.
Refs #24100.

Thanks tkhyn for the report and Tim for the review.
2016-08-24 01:17:18 -04:00
Tim Graham ad25fe7350 Fixed #27089 -- Added database alias to InconsistentMigrationHistory message. 2016-08-23 17:39:58 -04:00
Jim Nicholls 76ab885118 Fixed #27054 -- Fixed makemigrations crash with a read-only database. 2016-08-18 08:27:40 -04:00
Akshesh a71724cd04 Refs #26709 -- Added index name to AddIndex.describe(). 2016-08-16 09:11:33 -04:00
Akshesh 6a8372e6ec Fixed #26808 -- Added Meta.indexes for class-based indexes.
* Added the index name to its deconstruction.
* Added indexes to sqlite3.schema._remake_table() so that indexes
  aren't dropped when _remake_table() is called.

Thanks timgraham & MarkusH for review and advice.
2016-08-05 18:12:51 -04:00
Jarek Glowacki d117567c7d Fixed #27004 -- Made migrations consistency check ignore unapplied squashed migrations. 2016-08-05 18:01:55 -04:00
Akshesh b92c6b7d56 Refs #26709 -- Replaced Index.get_name() with set_name_with_model().
This removes the dependency of the Index class on its 'model'
attribute.
2016-08-02 14:21:41 -04:00
premanand lakshmanan 5da7e3f7fd Fixed #26114 -- Fixed AlterModelTable.describe() if db_table is None. 2016-07-28 10:33:14 -04:00
Akshesh bdba0fc195 Fixed typo in autodetector method name. 2016-07-17 15:18:39 -04:00
Tim Graham 944e66cb1d Reverted "Fixed #25388 -- Added an option to allow disabling of migrations during test database creation"
This reverts commit 157d7f1f1d since it
disables migrations all the time, not just during tests.
2016-07-14 09:21:28 -04:00
Jon Dufresne b84ecaa736 Fixed #26088 -- Made autodector detect changing proxy model to MTI. 2016-07-12 21:45:17 -04:00
Loïc Bistuer dab83e5ba1 Fixed #26881 -- Fixed duplicate managers in migrations.
When both parent and child models had managers with the same name and
a migrations opt-in both were added to the migration state.
2016-07-09 17:52:52 +07:00
Akshesh fc3ac65735 Refs #26709 -- Checked allow_migrate_model() in Add/RemoveIndex operations. 2016-07-07 10:37:39 -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
Akshesh f7e907115f Refs #26709 -- Added IndexOperation to avoid code duplication. 2016-07-07 07:35:26 -04:00
Akshesh b1e7d19d4c Refs #26709 -- Required a name for Indexes passed to AddIndex.
Thanks to Markush for discussions.
2016-07-07 07:31:23 -04:00
Akshesh 156e2d59cf Fixed #26709 -- Added class-based indexes.
Added the AddIndex and RemoveIndex operations to use them in migrations.

Thanks markush, mjtamlyn, timgraham, and charettes for review and advice.
2016-06-27 10:41:01 -04:00
Loïc Bistuer 2eb7cb2fff Fixed #26643 -- Prevented unnecessary AlterModelManagers operations caused by the manager inheritance refactor.
This also makes migrations respect the base_manager_name and
default_manager_name model options.

Thanks Anthony King and Matthew Schinckel for the initial patches.
2016-06-20 12:55:57 -04:00
Sergey Fedoseev 7fc4c1db62 Fixed #26710 -- Made CreateModel.references_model() take app_label into account. 2016-06-06 11:49:45 -04:00
Vytis Banaitis f1e408ff40 Fixed #25044 -- Fixed migrations for renaming ManyToManyField's through model. 2016-05-30 10:17:45 -04:00
Simon Charette 36d36818a3 Fixed #26647 -- Included the state of all applied migrations when migrating forward.
Thanks Jasper Maes for the detailed report.
2016-05-26 13:30:10 -04:00
Alex Hill 2ff7ef15b0 Refs #26421 -- Refactored Apps.lazy_model_operation() for better checks and tests 2016-05-19 21:33:36 -04:00
Loïc Bistuer ed0ff913c6 Fixed #10506, #13793, #14891, #25201 -- Introduced new APIs to specify models' default and base managers.
This deprecates use_for_related_fields.

Old API:

class CustomManager(models.Model):
    use_for_related_fields = True

class Model(models.Model):
    custom_manager = CustomManager()

New API:

class Model(models.Model):
    custom_manager = CustomManager()

    class Meta:
        base_manager_name = 'custom_manager'

Refs #20932, #25897.

Thanks Carl Meyer for the guidance throughout this work.
Thanks Tim Graham for writing the docs.
2016-05-17 12:07:22 +07:00
Loïc Bistuer 3a47d42fa3 Fixed #20932, #25897 -- Streamlined manager inheritance. 2016-05-17 02:29:22 +07:00
Simon Charette f937c9ec97 Fixed #24100 -- Made the migration signals dispatch its plan and apps.
Thanks Markus for your contribution and Tim for your review.
2016-05-15 19:51:15 -04:00
Tim Graham cb4be0262a Removed unused code in AlterField.database_forwards().
This code added in 107c9f5453 isn't
used after 4ce7a6bc84.
2016-05-14 06:43:40 -04:00
Simon Charette c0118ff80b Refs #24201 -- Ignored order_with_respect_to private fields in migrations.
Thanks Tim for the review.
2016-05-13 15:43:23 -04:00
Raphael Gaschignard 8f6a1a1551 Fixed #26429 -- Added a timestamp to merge migration names.
This reduces the possibility of a naming conflict, especially after
squashing migrations.
2016-05-11 08:19:19 -04:00
Iacopo Spalletti 49c57f8565 Fixed #25005 -- Made date and time fields with auto_now/auto_now_add use effective default.
Thanks to Andriy Sokolovskiy for initial patch.
2016-05-09 07:48:40 -04:00
Jarek Glowacki 509379a161 Fixed #25945, #26292 -- Refactored MigrationLoader.build_graph() 2016-05-08 13:53:26 +02:00
Markus Holtermann 3b383085fb Fixed #26555 -- Gave deconstructible objects a higher priority during serialization 2016-05-04 22:39:19 +02:00
Simon Charette f951bb78cb Refs #26521 -- Adjusted CreateModel bases validation to account for mixins.
Thanks Collin for the report.
2016-04-28 18:20:48 -04:00
Simon Charette a877a2f83d Refs #26521 -- Added the duplicated value to CreateModel validation messages.
Thanks Tim for the suggestion.
2016-04-27 16:17:22 -04:00
James Robert 417e083e55 Fixed #26521 -- Validated CreateModel bases, fields and managers for duplicates. 2016-04-27 12:43:56 -04:00
Matthew Schinckel 5402f3ab09 Fixed #26475 -- Added functools.partial() support to migrations autodetector. 2016-04-19 10:17:11 -04:00
Attila Tovt 02ae5fd31a Fixed #25850 -- Made migrate/makemigrations error on inconsistent history. 2016-04-05 08:52:08 -04:00
Tim Graham 2cd2d18851 Fixed W503 flake8 warnings. 2016-04-04 17:14:26 -04:00
Susan Tan b0803d64c4 Fixed #26075 -- Added clearer wording for one-off values in makemigrations 2016-04-03 17:12:55 +02:00
Iacopo Spalletti 394755b8d9 Fixed #26443 -- Corrected timezone.now in MigrationQuestioner prompt 2016-04-03 01:33:06 +02:00
Berker Peksag 157d7f1f1d Fixed #25388 -- Added an option to allow disabling of migrations during test database creation 2016-03-23 08:21:30 +08:00
Claude Paroz 983c158da7 Refs #24227 -- Replaced M2M isinstance checks by field.many_to_many
Thanks Markus Holtermann, Collin Anderson and Tim Graham for the reviews.
2016-03-19 09:24:27 +01:00
Noenglish Professorbut f8d20da047 Fixed a few docstring typos. 2016-03-12 08:45:06 -05:00
Jarek Glowacki 34c56687ae Fixed #26342 -- Prevented unpacking when repr a NodeNotFoundError 2016-03-10 17:27:35 +11:00
Akshesh b886f166b3 Fixed #26316 -- Factored duplicated code in model/field migration operations. 2016-03-03 18:24:36 -05:00