Claude Paroz
a159b1facd
Replaced migration state render() by apps cached property
...
Refs #23745 .
2015-01-02 15:19:36 +01:00
Andriy Sokolovskiy
3dbbb8a89c
Fixed #23983 -- Fixed a crash in migrations when adding order_with_respect_to to non-empty table.
2014-12-16 10:48:49 -05:00
Diego Guimarães
c17d821fa7
Refs #23947 -- Improved migrations tests table cleanup.
...
Copied technique from schema tests.
2014-12-15 19:05:19 -05:00
Markus Holtermann
aa5ef0d4fc
Fixed #23822 -- Added support for serializing model managers in migration
...
Thanks to Shai Berger, Loïc Bistuer, Simon Charette, Andrew Godwin,
Tim Graham, Carl Meyer, and others for their review and input.
2014-12-15 08:34:15 -05:00
Claude Paroz
e11c6fd218
Fixed #23909 -- Prevented crash when collecting SQL for RunSQL
...
Thanks James Rivett-Carnac for the report and Markus Holtermann
for the review.
2014-12-01 20:26:40 +01:00
wrwrwr
b481c85697
Corrected a docstring in tests/migrations/test_operations.py.
2014-12-01 11:37:51 -05:00
wrwrwr
9136ceb6fb
Replaced router.routers usage with override_settings(DATABASE_ROUTERS); refs #23933 .
2014-12-01 11:34:15 -05:00
Markus Holtermann
d2202ec2d4
Fixed #23880 -- Added missing index_together handling for SQLite
2014-12-01 11:30:33 +07:00
Markus Holtermann
912ad03226
Fixed #23894 -- Made deconstruct methods favor kwargs over args
2014-11-28 06:05:56 -05:00
Markus Holtermann
4c709cc0ef
Fixed duplicate index error on Oracle; refs #23859 .
...
Refers to regression introduced in 7b4a994599
2014-11-20 14:42:39 -05:00
Stratos Moros
cf7a2a000e
Fixed #22248 -- Made RenameModel reversible
2014-11-19 14:11:35 +02:00
Markus Holtermann
7b4a994599
Fixed #23859 -- Fixed a migration crash when a field is renamed that is part of an index_together
2014-11-17 19:15:07 +01:00
Simon Charette
68ef44c565
Removed references to the deprecated assertRaisesRegexp method.
2014-11-16 02:12:36 +01:00
Claude Paroz
70428902c0
Added missing available app in migrations test case
...
In some test combinations, having contrib.auth available but not
contrib.contenttypes can produce failures while creating permissions.
2014-10-23 15:39:26 +02:00
Tim Graham
41b337efa0
Fixed #23630 -- Made AlterModelTable rename auto-created M2M tables.
...
Thanks Naddiseo for the report, Andrew Godwin for guidance,
and Shai Berger for review.
2014-10-23 08:05:39 -04:00
Collin Anderson
4ef9618e12
Avoided requiring sqlparse for a test.
...
Refs #23426 . Thanks Markus Holtermann for the suggestion.
2014-10-09 14:59:33 -04:00
Collin Anderson
d6a87eefd8
Skip another test if sqlparse is not available
...
Refs #23426
2014-10-09 11:54:42 -04:00
Markus Holtermann
85f6d89313
Fixed #23426 -- Allowed parameters in migrations.RunSQL
...
Thanks tchaumeny and Loic for reviews.
2014-10-02 11:52:40 -04:00
Markus Holtermann
b9a670b227
Fixed #23426 -- Don't require double percent sign in RunSQL without parameters
2014-09-24 07:20:57 -04:00
Sergey Fedoseev
463952d940
Fixed #23503 -- Fixed renaming of model with self-referential m2m field.
2014-09-23 10:03:37 -04:00
Dave Hall
e03b7940e5
Fixed #22918 -- Fixed SeparateDatabaseAndState crash
2014-09-02 08:06:44 -04:00
Tim Graham
0ad4672c0f
Fixed typo in tests/migrations/test_operations.py
2014-08-15 11:01:49 -04:00
Andrew Godwin
8f9862cd4d
Fixed #23275 : Unmanaged models kept by autodetector, ignored by ops
2014-08-12 12:49:20 -07:00
Andrew Godwin
dfe86449c9
Fixed #23244 : Error altering FK to non-FK in migrations
2014-08-07 11:52:31 +10:00
Andrew Godwin
c06e124b5e
Fixed #23091 : CreateModel and AddField were clashing with deferred SQL
2014-08-04 11:59:29 +10:00
Simon Charette
1b00738f73
Fixed a MySQL test failure introduced by cbb29af1aa
.
...
Seems like unlike other backends MySQL get_constraints fails when dealing
with a non-existing table. refs #23160 .
2014-08-03 16:32:36 -04:00
Simon Charette
cbb29af1aa
Fixed #23160 -- Correctly rename models with self referential fields.
...
Thanks to whitews AT gmail for the report.
2014-08-03 15:27:01 -04:00
Andrew Godwin
d6e73a876d
Fixed #23121 : AlterModelOptions operation not changing state right
2014-07-28 10:47:28 -07:00
Andrew Godwin
e24e9e0438
Fixed #23014 : Renaming not atomic with unique together
2014-07-21 11:36:34 +01:00
Andrew Godwin
dcb4ed5170
Fixed #22975 : Don't call rename SQL if not needed
2014-07-21 10:14:00 +01:00
Tim Graham
0154965392
Fixed #23013 -- Fixed removing unique_together/index_together constraints in migrations.
...
Thanks melinath for the report.
2014-07-15 15:20:59 -04:00
Tim Graham
70576740b0
Fixed #22917 -- Fixed typo in AlterIndexTogether.describe().
2014-06-27 10:34:48 -04:00
Alex Gaynor
d015c9d11c
Fixed several flake8 errors
2014-06-18 07:47:13 -07:00
Andrew Godwin
405b9dcd8b
Fix broken test
2014-06-17 21:32:23 -07:00
Andrew Godwin
8d2ac948a9
Fixed #22853 : Swapped models are now ignored for migration operations.
2014-06-17 17:45:38 -07:00
Andrew Godwin
c8c79367a2
Fixed #22844 : Duplicate SQL for SQLite FKs
2014-06-16 00:27:32 -07:00
Alex Gaynor
d17a4cb037
Fixed several flake8 errors
2014-06-15 20:45:15 -04:00
Andrew Godwin
c1276785f9
Fixed #22568 : Better proxy model support in migrations
2014-06-15 16:01:49 -07:00
Andrew Godwin
a8ce5fdc28
Fixed #22470 : Full migration support for order_with_respect_to
2014-06-15 14:56:51 -07:00
Andrew Godwin
a58f49d104
Persist non-schema-relevant Meta changes in migrations
2014-06-15 12:34:02 -07:00
Andrew Godwin
4ce7a6bc84
Fixed #22750 , #22248 : Model renaming now also alters field FKs
2014-06-07 18:18:02 -07:00
Flavio Curella
beec05686c
Fixed #22667 -- Replaced leader/follower terminology with primary/replica
2014-05-22 11:59:17 -04:00
Tim Graham
dfeef8e147
Skipped a migrations test that's not supported on MySQL + Python 3.
2014-05-21 06:54:24 -04:00
Alex Gaynor
8a95b4fca7
Merge pull request #2692 from fcurella/patch-5
...
#22667 replaced occurrences of master/slave terminology with leader/follower
2014-05-20 09:37:04 -07:00
Flavio Curella
73a57b06f9
replaced occurrences of master/slave terminology with leader/follower
2014-05-20 11:35:16 -05:00
Andrew Godwin
03900a02d5
Fixed #22432 : SQLite M2M repointing now works. Thanks to xelnor.
2014-05-20 16:25:59 +01:00
Loic Bistuer
5789ff7330
Failing testcases for #22649 .
2014-05-18 12:46:12 +07:00
Loic Bistuer
1d3d01b4f7
Fixed #22424 -- Fixed handling of default values for TextField/BinaryField on MySQL.
...
Thanks syphar for the review and suggestions.
2014-05-18 11:58:16 +07:00
Aymeric Augustin
b1432bfc22
Appeased flake8.
2014-05-08 21:49:54 +02:00
Andrew Godwin
5a917cfef3
Fixed #22496 : Data migrations get transactions again!
2014-05-07 14:28:34 -07: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
Claude Paroz
ab90c4707b
Fixed table cleanup in GIS migration tests
2014-04-21 23:08:00 +02: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
Motiejus Jakštys
0e45669fa9
Fixed #22460 -- Explicity remove constraints when dropping a related field.
2014-04-16 15:38:31 -04:00
Loic Bistuer
a449e7feec
Fixed #22359 -- Changing M2M field to blank=True failed on sqlite.
2014-03-31 06:13:19 -04: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
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
Alex Gaynor
a248c88372
Fixed three small flake8 violations.
2014-03-04 15:13:15 -08:00
Loic Bistuer
99291f5db0
Added tests for MTI in RunPython.
2014-03-05 03:17:52 +07: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
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
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
be8173af51
Fixed a small collection of flake8 violations that had snuck in
2014-01-19 21:15:31 -06: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
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
Aymeric Augustin
b55282b98b
Moved list of models inside AppConfig instances.
...
This commit is a refactoring with no change of functionality, according
to the following invariants:
- An app_label that was in app_configs and app_models stays in
app_config and has its 'installed' attribute set to True.
- An app_label that was in app_models but not in app_configs is added to
app_configs and has its 'installed' attribute set to True.
As a consequence, all the code that iterated on app_configs is modified
to check for the 'installed' attribute. Code that iterated on app_models
is rewritten in terms of app_configs.
Many tests that stored and restored the state of the app cache were
updated.
In the long term, we should reconsider the usefulness of allowing
importing models from non-installed applications. This doesn't sound
particularly useful, can be a trap in some circumstances, and causes
significant complexity in sensitive areas of Django.
2013-12-17 10:17:44 +01:00
Aymeric Augustin
8662654d6d
Removed module-level functions for the app cache.
...
Since the original ones in django.db.models.loading were kept only for
backwards compatibility, there's no need to recreate them. However, many
internals of Django still relied on them.
They were also imported in django.db.models. They never appear in the
documentation, except a quick mention of get_models and get_app in the
1.2 release notes to document an edge case in GIS. I don't think that
makes them a public API.
This commit doesn't change the overall amount of global state but
clarifies that it's tied to the app_cache object instead of hiding it
behind half a dozen functions.
2013-12-17 10:17:44 +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
Alex Gaynor
cbf8e8aa12
Fixed a flake8 error
2013-12-05 08:08:34 -06: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
Andrew Godwin
106b019dc9
Massive migration optimiser improvements + RenameModel opn
2013-11-06 13:47:58 +00:00
Alex Gaynor
f67e18f39e
Fixed all E251 violations
2013-11-03 10:17:58 -08:00
Alasdair Nicol
c3aa2948c6
Fixed #21298 -- Fixed E301 pep8 warnings
2013-10-23 13:45:03 +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
f671fb9d11
Remove most errors when running migration tests twice
2013-09-25 16:11:05 +01:00
Andrew Godwin
fe9f342d8c
Allow callables as the argument to RunPython
2013-09-25 16:10:43 +01:00
Andrew Godwin
3b810c5656
Add RunPython migration operation and tests
2013-09-25 13:58:07 +01:00
Andrew Godwin
bacbbb481d
RunSQL migration operation and alpha SeparateDatabaseAndState op'n.
2013-09-07 11:03:38 -05:00
Andrew Godwin
ac45f9c9c5
Fix some small errors in the tests
2013-08-23 12:07:43 +01:00
Andrew Godwin
52edc16086
Add more stringent M2M tests and fix the bug they exposed
2013-08-19 13:50:26 +01: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
00276e0414
Add tests for the migrate command and fix a bug they exposed
2013-07-25 13:52:35 +01:00
Andrew Godwin
61ff46cf8b
Add AlterIndexTogether operation
2013-07-02 18:02:01 +01:00
Andrew Godwin
9ef715d256
Fix some bad test running under PostgreSQL
2013-07-02 11:51:38 +01:00
Andrew Godwin
67dcea711e
Add unique_together altering operation
2013-07-02 11:19:02 +01:00
Andrew Godwin
47e4b86ddf
Autodetect field alters
2013-06-20 15:19:30 +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