django - Deleted migration files- how to makemigrations without losing data -


i changed field on model class (which has no classes point to it, 1 foreign key pointing out of it). somehow, stuffed migrations , keeps saying "django.db.migrations.graph.nodenotfounderror:" looking migration files not exist.

i accidentally deleted several files in 'migrations' folder.

my database contains lot of data, , not want break it.

will lose data if i:

  1. remove table caused problem in first place (psql, \d, drop table tablename)

  2. delete migration files

  3. re run migration start?

    ./manage.py makemigrations

    ./manage.py migrate

can recommend way of fixing this?

here traceback: http://dpaste.com/0y1ydxs

aren't using git can migration files back? if not, install , use it, starting now

i suggest:

  1. make backup/dump of database first, in case goes wrong
  2. delete migrations
  3. empty migration table in psql
  4. call makemigrations
  5. call migrate --fake-initial

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -