On Wed, Jan 22, 2014 at 9:31 PM, Hannu Krosing <[email protected]> wrote:
>
> What about moving this kind of migration support from database driver
> to django core as an universal fallback ?
>

Definitely not! It's an awful way of doing migrations and only exists
because people use SQLite a lot for development; I'd personally like to
remove it someday, but that seems unlikely.



>
> My argument for this is that it is remarkably hard to do schema
> migrations properly even for backends which "support it". You do not
> want to end up with 3 days downtime "while the database migrates"
> because you trusted django to do the right thing and it worked ok in
> your (small) test database.
>
> Automatic migrations are very useful at development time, but need
> lots of TLC when done in production environment. They are hard enough
> to orchestrate propery at pure SQL level. Adding an extra layer on top
> with largely undefined performance characteristics makes things much
> more complikated still.
>

And this is why we have the sqlmigrate command so that you can get the SQL
and tweak it if you like without having to write it manually in the first
place.

South/django.db.migrations is actually relatively useful in production on
the bottom 95% of websites provided you're using PostgreSQL; most
operations it performs don't lock anything, and it's probably better than
your average programmer at writing DDL SQL. If you're in that top 5% and
have an actually sizeable database, then yes, you should look at the
scripts it produces, but it's still very useful for developers to use as
they make new features and the SQL it makes is usually an excellent start
if you want to hand-run the migration (and if it was just an ADD COLUMN
with NULL, then I'd let Django do it anyway as I know that's instantaneous
and lock-free, and Django handles all the transaction management around
migrations so it can roll back if things error).

Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFwN1urxD6p_qDN476zngAHyvTLc9RFWv6PLW-%2BrksC2yOuA-A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to