Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django-south migration order

South run migrations per app not in order migrations where created. This may cause some problem with dependencies between migrations. Sometimes it's needed to add depends_on attribute to migration class.

Is it possible to run south-migration in order they were created? And also, anyone know reason why south is doing it this way?

like image 431
matkk Avatar asked Aug 17 '12 11:08

matkk


People also ask

What is Django south?

South documentation South is a tool to provide consistent, easy-to-use and database-agnostic migrations for Django applications.

How Django migrations work?

Migrations are Django's way of propagating changes you make to your models (adding a field, deleting a model, etc.) into your database schema. They're designed to be mostly automatic, but you'll need to know when to make migrations, when to run them, and the common problems you might run into.

What is the difference between Syncdb and migrate command?

The migrate command is new in the upcoming Django 1.7, which hasn't been released yet. For earlier versions you can use syncdb , or the external app South. When you're reading the documentation, use the Documentation version switcher to select the correct version.


1 Answers

South has no idea in what order you created migrations between multiple apps. It could look at the file system metadata, but that would break horribly with 3rd party apps installed through a package manager, or when you deploy your app.

The depends_on and needed_by attributes where made exactly for this use case, so use them for that. See also http://south.readthedocs.io/en/latest/dependencies.html.

like image 69
Benjamin Wohlwend Avatar answered Oct 30 '22 18:10

Benjamin Wohlwend