albar
albar

Reputation: 3100

How to control the order of created fields during a migration

I add custom fields in a model that require to be created in the order they are defined in the model. In the file created by the Django migration, this order is not respected. Is there a way to tell Django makemigrations the order of operations ? I use Django 1.8 and MySQL 5.7.

Upvotes: 5

Views: 1650

Answers (1)

Alasdair
Alasdair

Reputation: 308919

There aren't any options that you can pass to the makemigrations command to specify the order.

However, you can reorder the operations in the migrations file that is created.

Upvotes: 8

Related Questions