If anyone wants to poke at our schema evolution code you should be able to apply this patch attached.
It's mostly working. The bugs I know about are: 1) M2M fields can't be repointed at new tables properly 2) there's some weird quirk with modifying null and db_index at the same time. i have to run the sqlevolve command twice to get the column to get altered and to have the index added. The patch also fixes a couple problems I discovered in Django's existing syncdb command and the way it handles unique and db_index arguments. Those bugs were: 1) syncdb sometimes seems to 'miss' setting up foreign key constraints between applications. 2) foreign key constraints were specified inconsistently. Sometimes a 'REFERENCES' clause was added to the CREATE TABLE and sometimes a CREATE CONSTRAINT was used. This caused problems with figuring out the names of the constraints I needed to remove. 3) indexes were created multiple times sometimes in cases where a primary key was set. 4) indexes were *not* created for unique columns. technically not a bug, but i can't see why you wouldn't want an index. For small tables, the cost of the inserting a record against an index is small - it's a small table and there just aren't that many inserts. For large tables, the lack of an index means you're going to incur a table scan. Again - this code is ugly and needs to be cleaned up a lot, but it's working well enough for us against postgresql+psycopg2. It doesn't work on any other backend. Test cases are in the tests/evolvedb/runtests.py script. You'll need to symlink from tests/evolvedbtests/db_settings/settings.py.postgresql script to tests/evolvedbtests/backend_settings.py. All the existing django tests seem to pass with my patches applied. There's no documentation but there's ~40 odd tests checked into that evolvedb tests directory. Unfortunately, I'm pressed for time for the forseeable future and I don't think I'll be able to spend a lot more time working on this code. vic On 12/14/06, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > On 12/13/06, Steve Hutton <[EMAIL PROTECTED]> wrote: > > > Does it have a realistic chance of being accepted into core if it's found > > to be bug free? Is it fully documented? Is the design controversial or > > does it follow a community consensus? > > There was discussion about the general problem of schema evolution > before the SOC project was started. The discussion was started by > Jacob, and other committers (Luke and Malcolm) weighed in at the time, > along with many other interested onlookers. The resulting design is on > the wiki. > > Assuming that the implementation matches the proposal, I would say > there is a realistic chance of it getting accepted into core. However, > this would require that the implementation is up to date, and bug free > (including tests to validate this status that are integrated into the > Django system tests). > > Yours, > Russ Magee %-) > > > > -- "Never attribute to malice that which can be adequately explained by stupidity." - Hanlon's Razor --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
schema_evo.patch.gz
Description: GNU Zip compressed data