Reputation: 35682
this is my model :
class zjm_model(models.Model):
a = models.CharField(max_length=36)
b = models.CharField(max_length=36)
and the table zjm_model
has many data in my mysql , and now ,
i want to add a new field :
class zjm_model(models.Model):
a = models.CharField(max_length=36)
b = models.CharField(max_length=36)
c = models.CharField(max_length=36)
but , when i run manage.py syncdb
, it show this :
No fixtures found.
so how can i to add a new field to my database ,
thanks
Upvotes: 3
Views: 1310
Reputation: 45
You have to dump your previous data.
manage.py dumpdata > dump.json
And you can load your data after syncdb. ("c" column have to permit null)
manage.py loaddata dump.json
Upvotes: -2
Reputation: 94202
south is very nice and all that, but if this is a very rare one-off thing then just fire up your favourite mysql tool and do something like: ALTER TABLE foo ADD COLUMN wotsit VARCHAR(100) - I can't remember the exact syntax...
But +1 for south.
Upvotes: 5