1
0
mirror of https://github.com/django/django.git synced 2024-12-26 19:16:11 +00:00
Commit Graph

72 Commits

Author SHA1 Message Date
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