Closed
Bug 1282907
Opened 8 years ago
Closed 8 years ago
NamedModel instances aren't unique
Categories
(Tree Management :: Treeherder, defect)
Tree Management
Treeherder
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: wlach, Assigned: wlach)
References
Details
Attachments
(1 file)
The NamedModel base class doesn't work particularly well. It has no uniqueness constraint on the "name" field which means that updating instances of this model using django's get_or_create is potentially racey.
Also, most of the fields aren't relevant in most cases.
I think we'd be best off fixing this simply by removing NamedModel and just defining the things we care about in each ORM class. The name field should always be unique.
Assignee | ||
Comment 1•8 years ago
|
||
Actually I think the NamedModel class is useful, now that I think about it. We just don't want all its properties in most cases (and 'name' should have the unique constraint). Let's fix that.
Comment 2•8 years ago
|
||
Assignee | ||
Updated•8 years ago
|
Attachment #8766043 -
Flags: review?(emorley)
Updated•8 years ago
|
Attachment #8766043 -
Flags: review?(emorley) → review+
Comment 3•8 years ago
|
||
Commit pushed to master at https://github.com/mozilla/treeherder
https://github.com/mozilla/treeherder/commit/f86dae6e61f7868fa53007c55cccbab6888140dd
Bug 1282907 - Fix named models to be more sane (#1624)
* Remove unused members from NamedModel (define in subclass where really
needed)
* Enforce uniqueness on name properties
Assignee | ||
Updated•8 years ago
|
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•