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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -