0

By mistake I deleted all the migration files from all apps on production server.

Now running python manage.py makemigrations and then python manage.py migrate raises:

"field already exists in the database"

error for each field, What should I do ?
django version: 1.7.7

M.javid
  • 6,387
  • 3
  • 41
  • 56
Kunal Kumar
  • 67
  • 3
  • 6
  • 1
    If your migrations are all auto generated, then you don't need to run `migrate` anymore. Just run `makemigrations` and leave the migration file there. I think you might consider using version controls like `git` to track all files, so you don't lose anything. – Shang Wang Aug 13 '15 at 17:43
  • 3
    Your code is all in version control, right? Just check out the latest version again and redeploy. – Daniel Roseman Aug 13 '15 at 17:56

2 Answers2

0

If you already migrated and then deleted.Then fake will help you

python manage.py migrate --fake
itzMEonTV
  • 19,851
  • 4
  • 39
  • 49
0

you have to fake the migration, the next command may help you:

python manage.py migrate 'name_app' 'name_migration' --fake

Example:

python manage.py migrate books 005_auto_20150505 --fake
Hetdev
  • 1,425
  • 2
  • 21
  • 29