On 2/20/07, Mike H <[EMAIL PROTECTED]> wrote: > > > For me, if there was a way to simply add missing columns that would be > enough. Any data manipulation should be done by a patch runner that can > be tested and automated, but simply adding missing columns to a table I > think should be done by syncdb.
the problem is how do you deal with NULL, default values, auto_now etc. plus you have to do this for all the db engines supported by django... but have a look at the schema-evolution branch, its goal is even loftier than just adding columns ;) > > The way I have approached this when producing ORMs in PHP that > automatically generate the schema is to create the classes table with > just the primary key column, then alter the table to add each of the > other columns. Then when you add new things to your model you can check > to see if the columns exist and use the exact same alter table sql > generation to add the new columns. > > Perhaps if I get some time to read through and understand the syncdb code > I can produce an add_missing_columns command... > > MIke > > On 2/20/2007, "Adrian Holovaty" <[EMAIL PROTECTED]> wrote: > > > > >On 2/19/07, kbochert <[EMAIL PROTECTED]> wrote: > >> If I have a Django model: > >> > >> class Poll(models.Model): > >> ... > >> > >> and decide that I need another field in the table, how do I proceed > >> while keeping the data? > > > >Hi Karl, > > > >See the FAQ: > > > >"If I make changes to a model, how do I update the database?" > >http://www.djangoproject.com/documentation/faq/#if-i-make-changes-to-a-model-how-do-i-update-the-database > > > >Adrian > > > >-- > >Adrian Holovaty > >holovaty.com | djangoproject.com > > > > > > > > -- Honza Kr�l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---