doniyor
doniyor

Reputation: 37914

django south migration issue

i am really stuck here. i have a model, where i am migrating well untill now. but today i added new field, then i did schemamigration app --auto, then it found the newly added field, but when i ran migrate app, it says, the field newfield doesnot exist. i dont understand why. i uncommented and tried to schemamigration and migrate again, it is spitting out the same error now. what did i wrong and what should i do now? i want to have a fixed steps for such cases :(

thanks for help

edit:

class User(models.Model):
  registerdate = models.CharField(max_length=400,default='')
  vorname = models.CharField(max_length=100,default='')
  nachname = models.CharField(max_length=100,default='')
  plz = models.CharField(max_length=10,default='')  <------------- this field i added
  land = models.CharField(max_length=100,default='')

the error says:

the following sql statement failed: ALTER TABLE home_user DROP COLUMN plz CASCADE;

but now, i have this field uncommented and if i try to migrate, it says: column PLZ of Relation USER does not exist. why is this? :(

Upvotes: 0

Views: 503

Answers (1)

Joel Crocker
Joel Crocker

Reputation: 155

i uncommented and tried to schemamigration and migrate again, it is spitting out the same error now.

Did you delete the migration you created after adding the new field? If not, then running migrate will keep trying to run this migration. Since you say it failed to run the first time, it will always keep failing to run unless it's corrected or deleted.

If that first migration really did fail to run, you could try deleting it (and any subsequent migrations you may have created), then recreating it.

Before trying that, though, it would be helpful for you to post more complete tracebacks of the errors you get when you run migrate. You may have a mismatch between what south thinks the state of your database is and what it actually is, but it's hard to say for sure without more information.

Upvotes: 3

Related Questions