Commit Graph

56 Commits

Author SHA1 Message Date
Andrew Godwin aa12ea05ce Rewrote migration autodetector to involve actual computer science.
Fixes #22605, #22735; also lays the ground for some other fixes.
2014-06-05 23:25:35 -07:00
Marc Tamlyn 6ab67919ac Made nested deconstruction support both forms of deconstruct()
Nested deconstruction should (silently) handle Field.deconstruct() as
well as other arbitrary deconstructable objects. This allows having a
field in the deconstruction of another field.
2014-05-22 13:23:51 +01:00
Andrew Godwin 5182efce8d Fixed #22563: Ignore AUTH_USER_MODEL errors in from_state 2014-05-08 21:34:30 -07:00
Claude Paroz 12474dacef Added a bunch of missing unicode_literals
Refs #22564.
2014-05-06 09:13:07 +02:00
Tim Graham 3818d96426 Fixed #22435 -- Prevented adding a ManyToManyField from prompting for a default.
Thanks andrewsg for the report.
2014-05-02 20:46:47 -04:00
Chris Beaven a0c4b8465d Fix migration autodector to work correctly with custom deconstructed values 2014-05-02 15:08:19 +12:00
Andrew Godwin 8f6dff372b Fixed #22485: Include all unmigrated apps in project state by default. 2014-04-30 12:25:12 -07:00
Andrew Gorcester 956bd64424 Fixed #22397 -- Issues removing M2M field with explicit through model
Changed the migration autodetector to remove models last so that FK
and M2M fields will not be left as dangling references. Added a check
in the migration state renderer to error out in the presence of
dangling references instead of leaving them as strings. Fixed a bug
in the sqlite backend to handle the deletion of M2M fields with
"through" models properly (i.e., do nothing successfully).

Thanks to melinath for report, loic for tests and andrewgodwin and
charettes for assistance with architecture.
2014-04-18 16:44:47 -04:00
Simon Charette 0d397e5a5b Revert "Fixed #22397 -- Issues removing M2M field with explicit through model."
This reverts commit 00e3b9a2a9.

It's causing a regression when tested with the proxy_model_inheritance tests.
2014-04-18 01:27:30 -04:00
Andrew Gorcester 00e3b9a2a9 Fixed #22397 -- Issues removing M2M field with explicit through model.
Changed the migration autodetector to remove models last so that FK
and M2M fields will not be left as dangling references. Added a check
in the migration state renderer to error out in the presence of
dangling references instead of leaving them as strings. Fixed a bug
in the sqlite backend to handle the deletion of M2M fields with
"through" models properly (i.e., do nothing successfully).

Thanks to melinath for report, loic for tests and andrewgodwin and
charettes for assistance with architecture.
2014-04-17 12:54:35 -04:00
Loic Bistuer 0fd51cf0bd Fixed #22319 -- Fixed migration external dependencies when there are internal dependencies. 2014-03-31 06:50:38 -04:00
Tim Graham 42336c84a0 Fixed #22331 -- Made MigrationAutodetector ignore unmanaged models.
This commit reverts 69d4b1c and tackle the issue from a different angle.
Models remain present in the project state, but are now ignored by the
autodetector.
2014-03-25 18:30:58 -04:00
Stephen Burrows 35ed792cf2 Fixed #22300 -- Fixed crash in migrations when changing non-relational field to relational. 2014-03-25 07:46:15 -04:00
Andrew Godwin 81f5408c7a Fixed #22275: unique_together broken if ForeignKey split into new file.
Thanks to bak1an for the patch.
2014-03-19 21:23:21 -07:00
Chris Beaven 40f6ca54f8 Fix autodetector creation of RenameModel migration to capitalize model names 2014-03-11 12:23:45 +13:00
Chris Beaven 7feb70eef3 Fixed #22239 -- Add auto detection of renamed models 2014-03-10 13:55:44 +13:00
Andrew Godwin 1232acb884 Don't allow really long migration names 2014-03-06 13:34:31 -08:00
Andrew Godwin e46e15e5a1 Fixed #22204: Bad circular-dep-breaking if more than one per run 2014-03-06 13:22:42 -08:00
Andrew Godwin 3c547a423f Merge pull request #2270 from bmispelon/ticket-22030
Fixed #22030 -- Don't assume that all fields have a swappable_setting at...
2014-02-17 01:16:49 +00:00
Anton Baklanov 0bd92d68ad Fixed #22035 -- reordered migration operations
Now AddField actions appear in operations list before AlterUniqueTogether
actions.

Thanks to SmileyChris for the report.
2014-02-14 20:00:39 -05:00
Baptiste Mispelon 6873eeeefb Fixed #22030 -- Don't assume that all fields have a swappable_setting attribute. 2014-02-13 17:43:21 +01:00
Andrew Godwin bad9456b9c Fix my slightly hasty autodetector changes 2014-02-12 17:22:50 +00:00
Andrew Godwin 11c021336c Fixed #21958: Handle dependencies for swappable models in AddField 2014-02-09 12:46:38 +00:00
Andrew Godwin 6758a9c0fc Fixed #21872: Not detecting dependencies from M2M fields 2014-01-27 11:49:55 +00:00
Andrew Godwin c9de1b4a55 Implement swappable model support for migrations 2014-01-19 16:43:12 +00:00
Andrew Godwin 64887c644a Fixed #21142: Dependency failures on unmigrated apps. 2014-01-08 13:00:12 +00:00
Aymeric Augustin 20d487c27b Replaced Options.object_name.lower() by Options.model_name.
Thanks Simon for the suggestion.

Also removed inappropriate lowercasing of app labels in migrations.
Unlike model names, they are case sensitive.
2013-12-29 18:48:37 +01:00
Aymeric Augustin 1716b7ce5a Renamed AppCache to Apps.
Also renamed app_cache to apps and "app cache" to "app registry".

Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
2013-12-24 12:25:17 +01:00
Andrew Godwin cee4fe7307 Better default name for migrations we can't give nice names to 2013-12-11 13:23:07 +00:00
Andrew Godwin 248fdb1110 Change FKs when what they point to changes 2013-12-11 13:16:29 +00:00
Baptiste Mispelon 72479a2957 Made the migration detector use meta.local_fields instead of meta.fields.
Refs #21010.

Thanks to Loïc for the patch.
2013-12-06 15:23:21 +01:00
Andrew Godwin 3b8e46cbc7 Migration VCS conflict detection and --merge for makemigrations 2013-12-04 16:01:49 +00:00
Andrew Godwin ce05b8a69e Don't make a second migration if there was a force-null-default addcol. 2013-12-04 13:56:22 +00:00
Simon Charette 42ac138009 Fixed a deprecation warning introduced by 96dd48c83f. 2013-11-28 21:42:24 -05:00
Andrew Godwin 96dd48c83f Change initial migration writing to work as docs suggest.
Application template now includes an empty migrations module, and
the autodetector will only make initial migrations for apps with
empty modules.
2013-11-27 12:34:31 +00:00
Milton Mazzarri cbc7cbbc5b Fixed flake8 E251 violations 2013-11-03 03:22:11 -06:00
Markus Holtermann 5a424c2393 Fixed #21114 -- Migrations must not have a dependency to themselves. 2013-09-17 11:47:19 -04:00
Andrew Godwin 05e14e8eaf Migration autodetector now corerctly deals with proxy models 2013-09-06 12:39:46 -05:00
Simon Charette 11cd7388f7 Fixed #20989 -- Removed useless explicit list comprehensions. 2013-08-30 10:57:51 -04:00
Andrew Godwin 2e7f45a372 Change autodetector changes API to be just one method 2013-08-21 22:25:15 +01:00
Andrew Godwin 21be9fef7b Stop being overcautious about Field.rel 2013-08-11 00:01:30 +01:00
Andrew Godwin 7970d97a70 Docs tweaks (thanks timgraham) 2013-08-10 20:00:12 +01:00
Andrew Godwin 9b4a789eef Add [y/n] to autodetector questions and allow for default value 2013-08-09 17:45:19 +01:00
Andrew Godwin c8cbdabfab Fix Python 3 support 2013-07-26 17:08:12 +01:00
Andrew Godwin 3b20af3e96 Autodetection of unique_together changes 2013-07-02 11:25:18 +01:00
Andrew Godwin e2d7e83256 Autodetect ForeignKeys and add dependencies/split on circulars 2013-06-22 17:15:51 +01:00
Andrew Godwin cca40703df Prompt about renames rather than doing them automatically 2013-06-21 15:32:15 +01:00
Andrew Godwin 92a10f5552 Autodetect field renames. HAHAHA. AHAHAHAHA. YES. 2013-06-20 16:02:43 +01:00
Andrew Godwin 47e4b86ddf Autodetect field alters 2013-06-20 15:19:30 +01:00
Andrew Godwin 73e30e9d3b Better naming, and prompt for NOT NULL field addition 2013-06-19 17:01:48 +01:00