Add id columns to all tables in status db

RESOLVED WONTFIX

Status

Release Engineering
General
P4
normal
RESOLVED WONTFIX
7 years ago
3 years ago

People

(Reporter: Pike, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [statusdb])

(Reporter)

Description

7 years ago
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.
Whiteboard: [statusdb]
django doesn't handle many-many association tables without an id column?  that seems very busted.
(Reporter)

Comment 2

7 years ago
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.
(Reporter)

Comment 4

7 years ago
Sadly, not. http://code.djangoproject.com/ticket/373
Priority: -- → P4
(Assignee)

Updated

4 years ago
Product: mozilla.org → Release Engineering

Updated

3 years ago
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.