Jobsets: add a SERIAL, unique, non-null id column

A postgresql column which is non-null and unique is treated with
the same optimisations as a primary key, so we have no need to
try and recreate the `id` as the primary key.

No read paths are impacted by this change, and the database will
automatically create an ID for each insert. Thus, no code needs to
change.
This commit is contained in:
Graham Christensen
2020-02-05 14:06:21 -05:00
parent 4a05bb36ac
commit e00030563b
3 changed files with 41 additions and 3 deletions

4
src/sql/upgrade-59.sql Normal file
View File

@@ -0,0 +1,4 @@
-- will automatically add unique IDs to Jobsets.
ALTER TABLE Jobsets
ADD COLUMN id SERIAL NOT NULL,
ADD CONSTRAINT Jobsets_id_unique UNIQUE (id);