What you're trying to do is called "Schema migration" or "evolution" there's been a lot of talk of it in the past. I recommend the South project for evolution. Very very flexible. Check it out here:
http://south.aeracode.org/ On Apr 17, 1:30 am, Rama Vadakattu <rama.vadaka...@gmail.com> wrote: > OR you can use django-evolutions which evolves the database schema in > sync with the models. > More details at :http://code.google.com/p/django-evolution/ > > On Apr 17, 10:29 am, zayatzz <alan.kesselm...@gmail.com> wrote: > > > > > If the tables of this app hold no info, then you can do python > > manage.py reset appname. This clears all tables of this app but the > > changes will hit database :) > > > Alan > > > On Apr 16, 7:11 pm, Aneesh <aneeshvkulka...@gmail.com> wrote: > > > > This is by design. syncdb only checks to see if it needs to create > > > any new DB tables for any models; it does NOT alter existing model > > > tables. Seehttp://docs.djangoproject.com/en/dev/ref/django-admin/#syncdb > > > for more info. > > > > If you don't have any valuable data in the table (ie, you're just > > > developing or playing around), the best thing to do is drop the whole > > > table from the DB entirely, and then syncdb will recreate it from > > > scratch with the new column included. You can also just issue an > > > ALTER TABLE to add the column manually with the proper name, and > > > Django will recognize it. > > > > Good luck, > > > Aneesh > > > > On Apr 16, 9:00 am, gry <georgeryo...@gmail.com> wrote: > > > > > [django: 1.1 beta 1 SVN-10407, python 2.5.2, ubuntu] > > > > My first django toy app. I've been working through the > > > > tutorialhttp://docs.djangoproject.com/en/dev/intro/tutorial02/. > > > > I've already done a few cycles of (change-model, ./manage.py syncdb) > > > > with success. > > > > I just added email and birthday fields to my Person model: > > > > > class Person(models.Model): > > > > name = models.CharField(max_length=200) > > > > def formalname(self): > > > > return 'Mr(Ms) ' + self.name > > > > phone = models.CharField(max_length=13) > > > > address = models.ForeignKey(Address) > > > > email = models.EmailField() > > > > birthday = models.DateField() > > > > def __unicode__(self): > > > > return self.name > > > > > I killed the server process(maybe not necessary). I did ./manage.py > > > > syncdb . > > > > Now "./manage.py sql phones" reports: > > > > CREATE TABLE "phones_person" ( > > > > "id" integer NOT NULL PRIMARY KEY, > > > > "name" varchar(200) NOT NULL, > > > > "phone" varchar(13) NOT NULL, > > > > "address_id" integer NOT NULL REFERENCES "phones_address" ("id"), > > > > "email" varchar(75) NOT NULL, > > > > "birthday" date NOT NULL > > > > ) > > > > but dbshell shows: > > > > CREATE TABLE "phones_person" ( > > > > "id" integer NOT NULL PRIMARY KEY, > > > > "name" varchar(200) NOT NULL, > > > > "phone" varchar(13) NOT NULL, > > > > "address_id" integer NOT NULL REFERENCES "phones_address" ("id") > > > > ); > > > > > I restart the server andhttp://127.0.0.1:8000/admin/phones/person/ > > > > gets me "Exception Value: > > > > no such column: phones_person.email". > > > > > Why is my change not making it into the DB? I even did "./manage.py > > > > flush" and it still fails on the email field. > > > > > -- George --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---