summaryrefslogtreecommitdiff
path: root/docs/topics
diff options
context:
space:
mode:
authorAndrew Godwin <andrewgodwin@eventbrite.com>2018-05-15 12:19:30 -0400
committerAndrew Godwin <andrew@aeracode.org>2018-05-15 12:20:25 -0400
commit0a8a6b4683a4d40181e39e000fd3c05ab4b3f652 (patch)
tree46add05777feb0b397ee43c17b23cd5c3e610c70 /docs/topics
parenta177f854c34718e473bcd0a2dc6c4fd935c8e327 (diff)
Add clarifying section about historical migration models
Diffstat (limited to 'docs/topics')
-rw-r--r--docs/topics/migrations.txt15
1 files changed, 13 insertions, 2 deletions
diff --git a/docs/topics/migrations.txt b/docs/topics/migrations.txt
index a45966ccb0..e3f7513433 100644
--- a/docs/topics/migrations.txt
+++ b/docs/topics/migrations.txt
@@ -352,8 +352,19 @@ Historical models
When you run migrations, Django is working from historical versions of your
models stored in the migration files. If you write Python code using the
:class:`~django.db.migrations.operations.RunPython` operation, or if you have
-``allow_migrate`` methods on your database routers, you will be exposed to
-these versions of your models.
+``allow_migrate`` methods on your database routers, you **need to use** these
+historical model versions rather than importing them directly.
+
+.. warning::
+
+ If you import models directly rather than using the historical models,
+ your migrations *may work initially* but will fail in the future when you
+ try to re-run old migrations (commonly, when you set up a new installation
+ and run through all the migrations to set up the database).
+
+ This means that historical model problems may not be immediately obvious.
+ If you run into this kind of failure, it's OK to edit the migration to use
+ the historical models rather than direct imports and commit those changes.
Because it's impossible to serialize arbitrary Python code, these historical
models will not have any custom methods that you have defined. They will,