Loic Bistuer
69d4b1c3ea
Fixed #22331 -- Fixed migrations ProjectState to ignore unmanaged models.
2014-03-25 10:33:44 -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
831ce69cbb
Mark model renaming as irreversible for now ( #22248 )
2014-03-19 21:25:26 -07: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
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
28779abb75
Fix bad conflict detection during makemigrations
2014-03-08 13:53:20 -08: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
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
Rodolfo Carvalho
0d91225892
Fixed many typos in comments and docstrings.
...
Thanks Piotr Kasprzyk for help with the patch.
2014-03-03 07:38:09 -05: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
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
80bbe2265d
Remove redunant code from RunPython operation
2014-02-12 17:21:25 +00:00
Andrew Godwin
935e6c1dfc
Fixed #21868 : Don't die when seeing py3 namespace packages for mig dirs
2014-02-09 14:03:41 +00:00
Andrew Godwin
11c021336c
Fixed #21958 : Handle dependencies for swappable models in AddField
2014-02-09 12:46:38 +00:00
Andrew Godwin
2085f53f56
Fixed #21968 : Bad detection of old-style apps to add initial migration
2014-02-09 11:42:10 +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
Berker Peksag
5d263dee30
Fixed #21674 -- Deprecated the import_by_path() function in favor of import_string().
...
Thanks Aymeric Augustin for the suggestion and review.
2014-02-08 11:12:19 -05:00
Marc Tamlyn
aea9faa146
Fix pep8 violation in migration template.
2014-02-05 14:39:44 +00:00
Carl Meyer
88a2d39159
Fixed #21874 -- Require Django applications to have a filesystem path.
...
Wherever possible this filesystem path is derived automatically from the app
module's ``__path__`` and ``__file__`` attributes (this avoids any
backwards-compatibility problems).
AppConfig allows specifying an app's filesystem location explicitly, which
overrides all autodetection based on ``__path__`` and ``__file__``. This
permits Django to support any type of module as an app (namespace packages,
fake modules, modules loaded by other hypothetical non-filesystem module
loaders), as long as the app is configured with an explicit filesystem path.
Thanks Aymeric for review and discussion.
2014-01-27 15:34:22 -07:00
Andrew Godwin
6758a9c0fc
Fixed #21872 : Not detecting dependencies from M2M fields
2014-01-27 11:49:55 +00:00
Aymeric Augustin
f901b4d6c8
Took advantage of the new get_model API. Refs #21702 .
2014-01-26 13:08:05 +01:00
Andrew Godwin
4b3b25104d
Fix soft-apply detection of migrations with dependencies
2014-01-24 12:26:38 +00:00
Markus Holtermann
047394f79c
Fixed #21852 -- Make migration writer serialize iterators
2014-01-22 09:21:54 +01:00
Andrew Godwin
6bbb820014
Fixed #21290 : Documented migration serializing and improved error
2014-01-19 19:27:30 +00:00
Andrew Godwin
3f1a008266
Fixed #21664 : Multi-table inheritance was duplicating _ptr fields
2014-01-19 18:35:49 +00:00
Andrew Godwin
1f5268a01f
Fixed #21786 : Bad behaviour when mixins + abstract bases for migrations
2014-01-19 18:09:52 +00:00
Andrew Godwin
af4a8478e4
Fixed #21783 : (again) Found second source of bug, also squashed it.
2014-01-19 17:43:31 +00:00
Andrew Godwin
e8d4aed3b9
Merge pull request #1681 from loic/migrations.format
...
Fixed #21323 -- Improved readability of serialized Operation.
2014-01-19 09:30:27 -08:00
Loic Bistuer
374faa4721
Fixed #21323 -- Improved readability of serialized Operation.
2014-01-20 00:16:07 +07:00
Andrew Godwin
1ea96acaf5
Fix unicode default input on py3
2014-01-19 17:14:31 +00:00
Andrew Godwin
c9de1b4a55
Implement swappable model support for migrations
2014-01-19 16:43:12 +00:00
Andrew Godwin
7535e9f4a4
Fixed #21784 : Correctly decode stdin input for migration defaults
2014-01-16 19:04:10 +00:00
Andrew Godwin
64887c644a
Fixed #21142 : Dependency failures on unmigrated apps.
2014-01-08 13:00:12 +00:00
Aymeric Augustin
c40209dcc0
Made it possible to change an application's label in its configuration.
...
Fixed #21683 .
2013-12-31 17:30:58 +01:00
Aymeric Augustin
bfcc686d22
Removed the only_with_models_module argument of get_model[s].
...
Now that the refactorings are complete, it isn't particularly useful any
more, nor very well named. Let's keep the API as simple as possible.
Fixed #21689 .
2013-12-30 23:59:34 +01:00
Aymeric Augustin
7ed20e0153
Populated Apps instances immediately by default.
2013-12-30 22:11:17 +01: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
ba7206cd81
Changed get_model to raise an exception on errors.
...
Returning None on errors required unpythonic error checking and was
inconsistent with get_app_config.
get_model was a private API until the previous commit, but given that it
was certainly used in third party software, the change is explained in
the release notes.
Applied the same change to get_registered_model, which is a new private
API introduced during the recent refactoring.
2013-12-28 20:53:00 +01:00
Aymeric Augustin
bbdf01e00a
Populated non-master app registries.
...
This removes the gap between the master app registry and ad-hoc app
registries created by the migration framework, specifically in terms
of behavior of the get_model[s] methods.
This commit contains a stealth feature that I'd rather not describe.
2013-12-28 20:37:42 +01:00
Aymeric Augustin
c81fae6b95
Used app_label instead of appname.
...
The last component of the dotted path to the application module is
consistently referenced as the application "label". For instance it's
AppConfig.label. appname could be confused with AppConfig.name, which is
the full dotted path.
2013-12-28 09:53:02 +01:00
Aymeric Augustin
2504a50cc2
Created a constant for the migrations module name.
...
Mostly for consistency with MODELS_MODULE_NAME; it's unlikely to change.
2013-12-27 15:36:19 +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
Aymeric Augustin
2fef9e5375
Moved apps back in the toplevel django namespace.
...
Reverted 4a56a93cc4
.
2013-12-22 11:39:55 +01:00
Aymeric Augustin
0242c56fd8
Deborgified the app cache.
...
Improved Andrew's hack to create temporary app caches to handle
migrations. Now the main app cache has a "master" flag set to True
(which is a non-default keyword argument, thus unlikely to be used by
mistake). Other app cache instances have "master" set to False.
The only sanctioned way to access the app cache is by importing
django.core.apps.app_cache.
If you were instanciating an app cache and relying on the Borg pattern,
you'll have to refactor your code.
2013-12-17 21:53:18 +01:00
Aymeric Augustin
4a56a93cc4
Moved the new app cache inside core.
2013-12-17 10:17:46 +01:00
Aymeric Augustin
5ba743e262
Made it possible to create apps without a models module.
...
This commit reverts f44c4a5d0f
and 39bbd165
.
django.test.simple will be updated in a separate commit as it requires
invasive changes.
2013-12-17 10:17:45 +01:00
Aymeric Augustin
69039becde
Deprecated get_app().
2013-12-17 10:17:45 +01:00
Aymeric Augustin
2732edc5f2
Deprecated get_apps().
2013-12-17 10:17:45 +01:00
Aymeric Augustin
259cd3cd41
Deprecated get_app_package, get_app_path and get_app_paths.
2013-12-17 10:17:45 +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
Aymeric Augustin
860c2c8bc5
Moved django.db.models.loading to django.apps.cache.
...
This commit doesn't contain any code changes; it's purely a refactoring.
2013-12-17 10:17:43 +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
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
Loic Bistuer
a2814846ca
Fixed E124 pep8 warnings.
2013-12-10 15:12:48 -05: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
Baptiste Mispelon
19e4374971
Fixed ModelState breaking when unique_together has unhashable elements.
2013-12-06 15:22:52 +01:00
Baptiste Mispelon
f463789f62
Added app_label to the error message when field reconstructing fails.
2013-12-06 15:22:47 +01:00
Andrew Godwin
a06fd092ef
Merge pull request #2037 from bmispelon/invalidbaseserror
...
Fixed TypeError when rendering ModelState with multiple bases.
2013-12-06 05:48:21 -08:00
maurycyp
4d0c72eb68
Removed unreachable `else` in `try` block.
2013-12-06 01:10:52 -05:00
Baptiste Mispelon
aba75b0d71
Fixed TypeError when rendering ModelState with multiple bases.
2013-12-06 00:55:31 +01:00
Andrew Godwin
e9c6d04224
Better error reporting when from_app_cache fails
2013-12-05 14:20:30 +00: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
67b51b9895
Include deferred SQL in sqlmigrate output
2013-11-27 16:29:37 +00:00
Andrew Godwin
5e63977c0e
Fixed #21438 : makemigrations now detects ManyToManyFields
2013-11-27 15:28:33 +00: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
Andrew Godwin
db4527e3c0
Fix squashed migration loading ordering issue
2013-11-27 12:29: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
Milton Mazzarri
cbc7cbbc5b
Fixed flake8 E251 violations
2013-11-03 03:22:11 -06:00
Alex Gaynor
7548aa8ffd
More attacking E302 violators
2013-11-02 13:12:09 -07:00
Tim Graham
36ded01527
Fixed #21302 -- Fixed unused imports and import *.
2013-11-02 15:24:56 -04:00
Andrew Godwin
e9cb333bc3
Auto-apply initial migrations if their tables exist already.
2013-10-30 15:17:49 +00: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
5ab8b5d72c
Fix migration planner to fully understand squashed migrations. And test.
2013-10-23 22:56:54 +01:00
Alasdair Nicol
c3aa2948c6
Fixed #21298 -- Fixed E301 pep8 warnings
2013-10-23 13:45:03 +01:00
Loic Bistuer
e565e1332d
Fixed #21275 -- Fixed a serializer error when generating migrations for contrib.auth.
...
The migration serializer now looks for a deconstruct method on any object.
2013-10-21 14:54:52 -04:00
Loic Bistuer
8d6953d55c
Added support for serializing class methods. - Refs #21290 .
...
The new handling allows us to do away with the whitelisting that was
required to support date and datetime objects.
2013-10-19 12:10:18 -04:00
Loic Bistuer
584110417f
Fixed #21283 -- Added support for migrations if models is a package.
...
Thanks Markus Holtermann for the report.
2013-10-19 09:48:57 -04:00
Andrew Godwin
763ac8b642
First pass on squashmigrations command; files are right, execution not.
2013-10-16 12:00:07 +01:00
Andrew Godwin
42f8666f6a
Improve migration optimizer to be able to optimize through other ops
2013-10-16 11:09:33 +01:00
Florian Apolloner
ed8919cbcb
Handle Apps with South migrations as unmigrated apps.
2013-10-15 11:57:30 +02:00
Tim Graham
adedc31072
Fixed "redefinition of unused 'foo' from line X" pyflakes warnings.
2013-10-10 11:09:42 -04: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
Andrew Godwin
05656f2388
Add equality support for Project/ModelState
2013-09-25 13:47:46 +01:00
Markus Holtermann
5a424c2393
Fixed #21114 -- Migrations must not have a dependency to themselves.
2013-09-17 11:47:19 -04: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
Loic Bistuer
d59f1993f1
Made MigrationWriter look for a "deconstruct" attribute on functions.
...
Refs #20978 .
2013-09-10 10:12:23 -04:00
Andrew Godwin
bacbbb481d
RunSQL migration operation and alpha SeparateDatabaseAndState op'n.
2013-09-07 11:03:38 -05:00
Loic Bistuer
adc0ab3386
Fixed #21037 -- Made MigrationWriter raise a ValueError when serializing lambda functions.
2013-09-06 20:13:01 -04:00
Andrew Godwin
efd1e6096e
Adding 'sqlmigrate' command and quote_parameter to support it.
2013-09-06 15:28:12 -05:00
Andrew Godwin
05e14e8eaf
Migration autodetector now corerctly deals with proxy models
2013-09-06 12:39:46 -05:00
Andrew Godwin
cdeff3acc2
Project/ModelState now correctly serialize multi-model inheritance
2013-09-06 12:16:03 -05:00
Andrew Godwin
9f6e6009a4
Add --list option to migrate command
2013-09-06 11:06:19 -05:00
Andrew Godwin
32838a5beb
Make db.migrations ignore South-style migrations.
2013-09-06 10:35:53 -05:00
Loic Bistuer
e1266e50b2
Fixed #21015 -- Fixed MigrationLoader when importlib.import_module returns a file module or an empty directory.
2013-09-06 08:30:19 -04:00
Loic Bistuer
82bbb9fe81
Fixed #21014 -- Fixed gobbled ImportError in MigrationLoader.
2013-09-06 08:30:18 -04:00
Loic Bistuer
34d52fd32e
Fixed #21010 -- Changed ModelState to only copy _meta.local_fields.
2013-09-04 14:05:59 -04:00
Loic Bistuer
ff9e116198
Fixed #21008 -- Made MigrationWriter handle Promise objects.
2013-08-31 20:26:44 -04: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
b61b634628
Fix weird planning issues when already fully migrated.
2013-08-11 15:28:51 +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
9f73629420
utils.importlib is deprecated
2013-08-09 17:36:16 +01:00
Andrew Godwin
fddc5957c5
Implement allow_migrate for migration operations
2013-07-30 12:34:31 +01:00
Andrew Godwin
c8cbdabfab
Fix Python 3 support
2013-07-26 17:08:12 +01:00
Andrew Godwin
52643a69e3
Add --fake option to migrate
2013-07-26 16:47:00 +01:00
Andrew Godwin
3f7113f1d9
Fix timezone warnings if USE_TZ=True
2013-07-26 16:46:48 +01:00
Andrew Godwin
a758c9c186
Add test for creating M2Ms
2013-07-25 16:36:58 +01:00
Andrew Godwin
162f7b938f
Make migrate command recognise prefixes and 'zero'.
2013-07-22 19:43:58 +01:00
Andrew Godwin
61ff46cf8b
Add AlterIndexTogether operation
2013-07-02 18:02:01 +01:00
Andrew Godwin
3b20af3e96
Autodetection of unique_together changes
2013-07-02 11:25:18 +01:00
Andrew Godwin
67dcea711e
Add unique_together altering operation
2013-07-02 11:19:02 +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
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
73e30e9d3b
Better naming, and prompt for NOT NULL field addition
2013-06-19 17:01:48 +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
ab5cbae9b7
First stab at some migration creation commands
2013-06-19 15:36:22 +01:00
Andrew Godwin
2ae8a8a77d
Fix test running with new apps stuff/migrate actually running migrations
2013-06-19 15:36:02 +01:00
Andrew Godwin
315ab41e41
Initial stab at a migrate command, it's probably quite a way off.
2013-06-07 18:47:17 +01:00
Andrew Godwin
91c470def5
Auto-naming for migrations and some writer fixes
2013-06-07 17:56:43 +01:00
Andrew Godwin
cd809619a2
Autodetector tests
2013-06-07 15:49:48 +01:00
Andrew Godwin
c7aa4b5338
Field encoding
2013-06-07 15:36:31 +01:00