On Thu, Aug 17, 2017 at 1:03 PM, Antonis Christofides <
anto...@djangodeployment.com> wrote:

> Second, just to make things clear, the word "migration" has two meanings.
> The original meaning of migration is to switch to another software system
> (e.g. migrate from MySQL to PostgreSQL, or migrate a repository from
> subversion to git). In Django, the term "migration" means something else:
> to update the database to the new schema. In my opinion this terminology is
> wrong and confusing (apparently it comes from Ruby on Rails, but I'm not
> certain), and a better one would have been "dbupdate" or something, but
> since it's migration we'll keep it and you'll have to understand which
> meaning is meant in each case.
>

An important thing worth knowing is that Django's migration framework does
*not* only track the database schema. It also tracks the state of the
Python classes which define the models, including options which do not
affect the underlying DB schema, and making such changes to a model will
create the need for a migration.

This is absolutely necessary, though, because the migration framework
generates a frozen snapshot of the state at each migration, so that you can
access the ORM to do things like data updates via the RunPython migration
operator. If you were to change, say, the default ordering of a model
without also generating a migration to record that change (even though it
has no effect on the database schema), you could run into trouble if you
later removed a field referenced by the old ordering, since one of the
intermediate ORM snapshots would attempt to order queries by a
now-nonexistent column.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL13Cg_0p1pMtMR2y2eGry1UhQaSRpswntcnMWtHNdPgV1Ph9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to