Reputation: 17392
I imported the external database into my project , thereby converting it to models.py
file using python manage.py inspectdb > models.py
command.
Now I have edited the models.py file by adding another class. How can I export the models.py
file onto the MySql server without hampering the data already in the database?
Upvotes: 1
Views: 921
Reputation: 354
Follow this screen cast http://pressedweb.com/tutorials/django-djourney-introduction-to-south/
Then search in google or stackoverflow for your requirements. There are already have some threads regrading this matter in stackoverflow. But before doing south migration don't forget to backup your database.
Upvotes: 1
Reputation: 99660
Basically, what you need is a syncdb
Creates the database tables for all apps in INSTALLED_APPS whose tables have not already been created.
But, syncdb will only create tables for models which have not yet been installed. It will never issue ALTER TABLE
statements to match changes made to a model class after installation.
There are 3rd party apps in django like django-south which manage the migrations for you, so you dont have to do all this manually.
Here is a link that explains how to work with south
Upvotes: 3