Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "Migrating a Django application" mean?

I kept thinking a lot about the meaning of migrating a Django app the last few days and heard about migrating Django apps with django-south. Maybe it's just the lack of sufficient English skills (as English is not my native language) or this is one of the things you confront in a programmer's life which are so simple, that it takes a genius to understand them (at first).

I've read the translation of 'migrate' in my native language, read the definition of migration on Wikipedia and read "the idea" of django-south, citing:

With South, you install it and then give one or more of your apps some migrations (either writing them by hand, or autogenerating them from your model definitions). When you syncdb, you'll only sync apps that don't have migrations (things like django.contrib.auth, for example, which have a fixed schema), and then when you run ./manage.py migrate, South kicks in and does the migrations. Intelligently.

This is confusing and I still don't understand the whole thing behind "migration of django applications" or "migration in general". I'd understand if I'd know how to interpret the word migration

You get the point, I hope.

Have patience with me, but I'd really like to know. So maybe one of you could explain me, please.

Thanks for your time in advance.

like image 535
Kenny Meyer Avatar asked Dec 22 '09 23:12

Kenny Meyer


1 Answers

When it comes to talking about South and Django, a migration refers to changing the database schema.

The syncdb command that is built into Django cannot automatically change schema for you without deleting everything first, which is why things like South and dmigrations have come about.

So, essentially a migration is a way to alter your database schema while keeping your data intact.

From the dmigrations page:

With dmigrations, every change to your database (including the creation of your initial tables) is bundled up in a migration. Migrations are Python files that live in a migrations directory. They can be applied and un-applied (reverted) in sequence.

like image 109
TM. Avatar answered Sep 17 '22 11:09

TM.