Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am working on a Django project with a MySQL backend. I'm curious about the best way to update a production server's database to reflect the changes made on the development server's database?

When I develop now, I make some changes to a models.py file, then to a schemamigration using South. Sometimes I do several migrations across several apps within the main project folder before it's ready for the production database. This means that there are several migration files in the app/migrations/ folder created by South.

So on the production server, how does one update the database to reflect all the changes made in development, without having any data loss?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You need to creation migrations. South is probably most people's go to app in the Django world

http://south.aeracode.org/

share|improve this answer
    
I am using South, I mentioned it in my question. I'm not sure I understand what you're saying. –  Garfonzo Nov 9 '12 at 6:34
    
once your migration files are in place just run ./manage.py migrate you don't lose any data stored in the table. –  Mike Nov 9 '12 at 14:56
    
Won't that be a problem if on the development server, I've run ./manage migrate several times due to multiple DB changes but, running ./manage.py migrate on the production server only picks up the latest migration, not all the migrations that happened along the way? I guess I'm worried about missing migrations in between the first and last migration that I do on the dev server. –  Garfonzo Nov 9 '12 at 15:25
    
as long as all your migration files are in place it should pick them all up. –  Mike Nov 9 '12 at 15:31
    
oh... wow, ok, and for sure they all go to the production server. Great thanks. –  Garfonzo Nov 9 '12 at 15:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.