Last Comment Bug 611014 - Add id columns to all tables in status db
: Add id columns to all tables in status db
Status: RESOLVED WONTFIX
[statusdb]
:
Product: Release Engineering
Classification: Other
Component: Other (show other bugs)
: other
: All All
: P4 normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-11-10 08:27 PST by Axel Hecht [:Pike]
Modified: 2014-06-17 08:45 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments

Description Axel Hecht [:Pike] 2010-11-10 08:27:44 PST
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.
Comment 1 Chris AtLee [:catlee] 2010-11-11 06:29:00 PST
django doesn't handle many-many association tables without an id column?  that seems very busted.
Comment 2 Axel Hecht [:Pike] 2010-11-11 06:33:24 PST
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".
Comment 3 Dustin J. Mitchell [:dustin] 2010-11-11 08:19:52 PST
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.
Comment 4 Axel Hecht [:Pike] 2010-11-11 08:33:10 PST
Sadly, not. http://code.djangoproject.com/ticket/373

Note You need to log in before you can comment on or make changes to this bug.