开发者

How can I drop the tables and syncdb for just one app in my Django project?

开发者 https://www.devze.com 2023-04-06 10:57 出处:网络
I have a Django app deployed on DjangoZoom. People have been signing up, so there are users in that database.

I have a Django app deployed on DjangoZoom. People have been signing up, so there are users in that database.

I want to restructure the database of one of my apps within the project. My plan was to drop all the tables then do syncdb to establish the new structure. Then, I would add all the content from the site back by installing local开发者_如何转开发ly-created fixtures on the production database.

The problem is I would lose all this user data with the plan. How do I just drop the relevant tables (the ones for which I can re-load the content with fixtures) and leave the auth tables intact? Please note that on DjangoZoom I only have the ability to run manage.py commands with --noinput and I can not access the database directly. Also, my project is in Django 1.3, so using manage.py reset app_name has been deprecated.

I suppose I could do south migrations for this, but it is a relatively simple change and since I have all the data in fixtures anyway it doesn't seem worth it. Any suggestions?


Just do:

./manage.py reset appname


I ended up implementing south for migrations to make changes to the tables on DjangoZoom instead of trying to clear the tables for some apps.

The changes were easily made to the existing database by using south's schemamigration --auto to generate a migration for the changes. Also, doing a migration allowed me to preserve most of the content in my project.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号