Closed Bug 611014 Opened 10 years ago Closed 7 years ago
Add id columns to all tables in status db
I've managed to set up a django model set for status db. I've hit one issue, and that is that django really likes to have id columns for any table that it creates models for, and that includes the intermediate models for many-to-many relationships. It'd be really helpful to add those, right now, the following SQL should do it, judging from the status db export: ALTER TABLE build_properties ADD COLUMN `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY FIRST; ALTER TABLE build_requests ADD COLUMN `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY FIRST; ALTER TABLE file_changes ADD COLUMN `id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY FIRST; This would open up the status db to all the django-based webdev infrastructure and momentum we have at mozilla right now. A similar request holds for scheduler db, but I'll file that over at buildbot.net.
django doesn't handle many-many association tables without an id column? that seems very busted.
Some queries can really only be done effienctly by doing a query on the association table directly, which in terms of django, means instantiating the models. And for that it needs the id column, yeah. The other queries that don't try to instantiate the model work, still. That's not really sweet, and a known bug or shortcoming, but really low on their priority list. It's easy to work around in most cases, "just add a column".
I thought django could handle compound primary keys? A many-to-many table's primary key is just the two foreign keys. That said, the "many" side of a one-to-many table should legitimately have a primary key.
Sadly, not. http://code.djangoproject.com/ticket/373
Product: mozilla.org → Release Engineering
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.