Commit Graph

96 Commits

Author SHA1 Message Date
Andrew Godwin 1fe941adb0 Prevent operation pollution by later operations of fields 2014-06-05 23:34:13 -07:00
Andrew Godwin 5a917cfef3 Fixed #22496: Data migrations get transactions again! 2014-05-07 14:28:34 -07:00
Claude Paroz 12474dacef Added a bunch of missing unicode_literals
Refs #22564.
2014-05-06 09:13:07 +02:00
Aymeric Augustin 8b5b199e20 Fixed #3214 -- Stopped parsing SQL with regex.
Avoided introducing a new regex-based SQL splitter in the migrations
framework, before we're bound by backwards compatibility.

Adapted this change to the legacy "initial SQL data" feature, even
though it's already deprecated, in order to facilitate the transition
to migrations.

sqlparse becomes mandatory for RunSQL on some databases (all but
PostgreSQL). There's no API to provide a single statement and tell
Django not to attempt splitting. Since we have a more robust splitting
implementation, that seems like a good tradeoff. It's easier to add a
new keyword argument later if necessary than to remove one.

Many people contributed to both tickets, thank you all, and especially
Claude for the review.

Refs #22401.
2014-04-26 17:46:23 +02:00
Andrew Godwin 831ce69cbb Mark model renaming as irreversible for now (#22248) 2014-03-19 21:25:26 -07:00
Chris Beaven 107c9f5453 Fix AlterField migrations that are related to a RenameModel migration 2014-03-11 17:13:26 +13:00
Anubhav Joshi bb2ca9fe6c Fixed #22172 -- Allowed index_together to be a single list (rather than list of lists)..
Thanks EmilStenstrom for the suggestion.
2014-03-01 15:44:42 -05:00
Andrew Godwin cbd04c7c49 Fix keyword agument names in RunPython to be positional 2014-02-28 09:22:48 -08:00
Andrew Gorcester 202bf69c2f Fixed #22095 -- Enabled backward migrations for RunPython operations
Added reversible property to RunPython so that migrations will not
refuse to reverse migrations including RunPython operations, so long as
reverse_code is set in the RunPython constructor. Included tests to
check the reversible property on RunPython and the similar RunSQL.
2014-02-23 09:30:02 +01:00
Andrew Godwin 80bbe2265d Remove redunant code from RunPython operation 2014-02-12 17:21:25 +00:00
Tim Graham 4f8e8a6ec2 Removed unused imports + other flake8 fixes. 2014-02-09 06:13:10 -05:00
Andrew Godwin 98dd8dd02e Fixed #21892: RunPython no longer accepts strings 2014-02-09 10:54:02 +00:00
Andrew Godwin af4a8478e4 Fixed #21783: (again) Found second source of bug, also squashed it. 2014-01-19 17:43:31 +00:00
Loic Bistuer 374faa4721 Fixed #21323 -- Improved readability of serialized Operation. 2014-01-20 00:16:07 +07: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 5db028affb Fix altering of SERIAL columns and InnoDB being picky about FK changes 2013-12-11 14:19:05 +00:00
Andrew Godwin 248fdb1110 Change FKs when what they point to changes 2013-12-11 13:16:29 +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
Alex Gaynor e5b7045422 flake8 fixes 2013-11-06 20:00:48 -08:00
Andrew Godwin 106b019dc9 Massive migration optimiser improvements + RenameModel opn 2013-11-06 13:47:58 +00:00
Alex Gaynor c347f78cc1 Fixed all E226 violations 2013-11-03 10:08:55 -08:00
Tim Graham 36ded01527 Fixed #21302 -- Fixed unused imports and import *. 2013-11-02 15:24:56 -04:00
Baptiste Mispelon 497930b7f6 Use `callable` instead of `six.callable`.
The `callable` builtin was added back in python 3.2
which is the minimal python3 version supported by django
at this point.
2013-10-29 21:53:51 +01:00
Andrew Godwin 42f8666f6a Improve migration optimizer to be able to optimize through other ops 2013-10-16 11:09:33 +01:00
Javed Khan 4dbd95ad65 Fixed #21236 -- Allowed migrations to work with unique_together tuples.
Thanks hjwp for the report.
2013-10-07 09:39:14 -04:00
Andrew Godwin a80d9ab0fe Initial version of MigrationOptimizer and tests 2013-10-02 17:34:22 +01:00
Andrew Godwin 6d3faba2d2 Add reverse_code optional argument to RunPython 2013-09-25 17:21:20 +01:00
Andrew Godwin fe9f342d8c Allow callables as the argument to RunPython 2013-09-25 16:10:43 +01:00
Andrew Godwin 8a3e543f26 Make sqlmigrate ignore the RunPython operation 2013-09-25 14:37:44 +01:00
Andrew Godwin 3b810c5656 Add RunPython migration operation and tests 2013-09-25 13:58:07 +01:00
Alex Gaynor bac86ad1a3 REmoved some unused imports 2013-09-14 12:34:57 -07:00
Gregor MacGregor b2b763448f Fixed #20841 -- Added messages to NotImplementedErrors
Thanks joseph at vertstudios.com for the suggestion.
2013-09-10 11:09:59 -04:00
Andrew Godwin bacbbb481d RunSQL migration operation and alpha SeparateDatabaseAndState op'n. 2013-09-07 11:03:38 -05:00
Andrew Godwin fddc5957c5 Implement allow_migrate for migration operations 2013-07-30 12:34:31 +01:00
Andrew Godwin a758c9c186 Add test for creating M2Ms 2013-07-25 16:36:58 +01:00
Andrew Godwin 61ff46cf8b Add AlterIndexTogether operation 2013-07-02 18:02:01 +01:00
Andrew Godwin 67dcea711e Add unique_together altering operation 2013-07-02 11:19:02 +01:00
Andrew Godwin 80bdf68d6b Add AlterField and RenameField operations 2013-06-20 15:12:59 +01:00
Andrew Godwin 6f667999e1 Add operation that renames tables 2013-06-20 14:54:11 +01:00
Andrew Godwin 41214eaf18 Autodetect fields, have migrate actually work 2013-06-19 16:41:04 +01:00
Andrew Godwin f25a385a5e Makemigration command now works 2013-06-19 16:23:52 +01:00
Andrew Godwin 4492f06408 A bit of an autodetector and a bit of a writer 2013-06-07 15:28:38 +01:00
Andrew Godwin 8d81c6bc82 Use correct model versions for field operations 2013-05-30 18:24:20 +01:00
Andrew Godwin e6f7f4533c Add an Executor for end-to-end running 2013-05-30 18:08:58 +01:00
Andrew Godwin d0ecefc2c9 Start adding operations that work and tests for them 2013-05-29 17:47:10 +01:00
Andrew Godwin 76d93a52cd Make a start on operations and state (not sure if final layout) 2013-05-10 17:07:13 +01:00