0

I am stuck with this issue: I had some migration problems and I tried many times and on the way, I deleted migrations and tried again and even deleted one table in db. there is no data in db, so I don't have to fear. But now if I try syncdb it is not creating the table I deleted manually.

Honestly, I get really stuck every time with this such kind of migration issues.

What should I do to create the tables again?

6
  • 1
    Can you add you settings.py file and may be one of your models file and the project structure from root to one models.py file Commented Aug 1, 2013 at 13:56
  • If you are not worried aobut data, create a new database and start afresh Commented Aug 1, 2013 at 14:06
  • @karthikr, creating new db is a rude solution, is there really no solution here? Commented Aug 1, 2013 at 14:07
  • why is it rude? You dont care about the data, and when you do syncdb, you start afresh anyways. Commented Aug 1, 2013 at 14:11
  • @karthikr, you are right. but now i did syncdb --all. it worked now. but i dont know why it did :) Commented Aug 1, 2013 at 14:12

4 Answers 4

2

To be sure you are deleting south history and to use syncdb as if no south exists, you have to delete migrations in two places:

  1. In the database: remove tables created by south
  2. Migration files: remove folders used by south. They are like "app_name/migrations"

If you don't need any data in your database (because it is testing for example), instead of remove only south tables, y recommend to do a complete reset. The commando to do that is

python manage.py reset_db --router=default

Hope it helps!

Some extra help

Generally, when you use syncdb and south is in your INSTALLED_APPS you get a message saying that some apps won't be synced and that you have to use migrations. Try to do a syncdb and look at the apps that can't be synced. If there are some of them, remove the "migrations" folder inside that apps and make a syncdb again. The app should't appear again in the list that can't be synced.

Sign up to request clarification or add additional context in comments.

Comments

0

are you using south?

If you are, there is a migration history database that exists. Make sure to delete the row mentionnaing the migration you want to run again.

1 Comment

i deleted all migrations
0

Try to use the comand reset in the app, something like that:

python manage.py reset my_app

1 Comment

i did, it deletes only data and doesnot create tables
0

Try renaming the migration file and running python manage.py syncdb.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.