Commit Graph

149 Commits

Author SHA1 Message Date
Aymeric Augustin 3bb0f118ca [1.7.x] 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.

Backport of 8b5b199 from master
2014-04-26 17:46:57 +02:00
Claude Paroz 1d0f1ee199 [1.7.x] Fixed table cleanup in GIS migration tests
Backport of ab90c4707b from master.
2014-04-22 19:52:58 +02:00
Aymeric Augustin 62eb79fc4c [1.7.x] Appeased flake8 2.1.0.
Backport of 428c0bbe1b from master
2014-04-21 07:50:50 -04:00
Tim Graham 9e86c3f0a6 [1.7.x] Fixed flake8 errors.
Backport of 471fb04a30 from master
2014-04-20 13:09:12 -04:00
Andrew Gorcester bc5d568e1e [1.7.x] 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.

Backport of 956bd64424 from master
2014-04-18 18:34:00 -04:00
Motiejus Jakštys 71c8ae543f [1.7.x] Fixed #22460 -- Explicity remove constraints when dropping a related field.
Backport of 0e45669fa9 from master
2014-04-16 16:37:08 -04:00
Simon Charette 9fb61cb64a [1.7.x] Fixed #22350 -- Consistently serialize bytes and text in migrations.
Thanks to @treyhunner and Loïc for their suggestions and review.

Backport of 72d3889db4 from master
2014-04-13 19:03:20 -04:00
Simon Charette 7b3a221ad6 [1.7.x] Fixed #22363 -- Correctly serialize `django.utils.datetime_safe` objects.
Thanks to linovia for the report.

Backport of 074d3183d9 from master
2014-04-03 14:56:41 -04:00
Loic Bistuer 8e73d3a2c1 [1.7.x] Fixed #22319 -- Fixed migration external dependencies when there are internal dependencies.
Backport of 0fd51cf0bd from master
2014-03-31 06:57:44 -04:00
Loic Bistuer bdec848063 [1.7.x] Fixed #22359 -- Changing M2M field to blank=True failed on sqlite.
Backport of a449e7feec from master
2014-03-31 06:35:06 -04:00
Loic Bistuer 39fc8d4b8e [1.7.x] 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.

Backport of 42336c84a0 from master
2014-03-25 20:04:49 -04:00
Tim Graham d84beb3d91 Revert "[1.7.x] Fixed #22331 -- Fixed migrations ProjectState to ignore unmanaged models."
This reverts commit bf69375c4d.
2014-03-25 12:07:37 -04:00
Loic Bistuer bf69375c4d [1.7.x] Fixed #22331 -- Fixed migrations ProjectState to ignore unmanaged models.
Backport of 69d4b1c3ea from master
2014-03-25 10:34:28 -04:00
Stephen Burrows b4f165fe94 [1.7.x] Fixed #22300 -- Fixed crash in migrations when changing non-relational field to relational.
Backport of 35ed792cf2 from master
2014-03-25 07:46:48 -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
Andrew Godwin f4d91638fc Remove failing test while we fix the underlying bug 2014-03-11 10:33:57 -07:00
Chris Beaven 107c9f5453 Fix AlterField migrations that are related to a RenameModel migration 2014-03-11 17:13:26 +13: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 abccbcf52d Fixed #21843: Remove explicit ID column setting in test 2014-03-08 16:04:21 -08:00
Andrew Godwin cdf6eba181 Merge pull request #2315 from bendavis78/issues/22073
Fixed #22073 - Ensure CreateTable operation handles backwards migration correctly when M2M fields are present
2014-03-08 15:44:45 -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
Alex Gaynor a248c88372 Fixed three small flake8 violations. 2014-03-04 15:13:15 -08:00
Loic Bistuer 6436f1fad9 Fixed #21893 -- ModelState didn't account for MTI parents inherited from abstract models. 2014-03-05 03:25:14 +07:00
Loic Bistuer 99291f5db0 Added tests for MTI in RunPython. 2014-03-05 03:17:52 +07: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
Baptiste Mispelon c679cb7f60 Fixed #22168 -- Fixed migrations failing on sqlite when column names are SQL keywords
Thanks to trac user fallen_flint for the report and initial patch.
2014-03-01 13:45:45 +01:00
Alex Gaynor a8a5c31966 Two whitespace changes to appease flake8 2014-02-23 11:07:52 -06: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
Ben Davis df2652c448 Fixed #22073 - Ensure CreateTable operation handles backwards migration correctly when M2M fields are present 2014-02-17 16:51:40 -06: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
Baptiste Mispelon c3434fed5b Removed test for migration check forgotten in 7e941ba67c. 2014-02-13 09:31:39 +01:00
Andrew Godwin bad9456b9c Fix my slightly hasty autodetector changes 2014-02-12 17:22:50 +00:00
Andrew Godwin 97a8fd4682 Fixed #21954: Raise nice error when serializing datetimes with timezones 2014-02-09 11:17:38 +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
mlavin a3e0d7753d Adding tests for check_migrations. 2014-02-08 09:05:27 -05:00
Michael Manfre ad913f242d Fix regress added to migrations.test_operations.test_alter_field_pk_fk 2014-02-02 15:44:01 -05:00
Michael Manfre 3ffeb93186 Ensure cursors are closed when no longer needed.
This commit touchs various parts of the code base and test framework. Any
found usage of opening a cursor for the sake of initializing a connection
has been replaced with 'ensure_connection()'.
2014-02-02 12:47:21 -05:00
Alex Gaynor 2ba09c000d Added some missing whitespace around arithmetic operators 2014-01-22 09:21:05 -06:00
Markus Holtermann 047394f79c Fixed #21852 -- Make migration writer serialize iterators 2014-01-22 09:21:54 +01:00
Alex Gaynor be8173af51 Fixed a small collection of flake8 violations that had snuck in 2014-01-19 21:15:31 -06:00
Russell Keith-Magee d818e0c9b2 Fixed #16905 -- Added extensible checks (nee validation) framework
This is the result of Christopher Medrela's 2013 Summer of Code project.

Thanks also to Preston Holmes, Tim Graham, Anssi Kääriäinen, Florian
Apolloner, and Alex Gaynor for review notes along the way.

Also: Fixes #8579, fixes #3055, fixes #19844.
2014-01-20 10:45:21 +08:00
Andrew Godwin 51832c8aec Remove other unicode literal 2014-01-19 18:57:59 +00:00
Andrew Godwin b1fc8c19b2 Remove unicode prefix that snuck in 2014-01-19 18:57:06 +00:00
Andrew Godwin 3f1a008266 Fixed #21664: Multi-table inheritance was duplicating _ptr fields 2014-01-19 18:35:49 +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