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:
@ -52,6 +52,7 @@ create table ProjectMembers (
|
||||
-- describing build jobs.
|
||||
create table Jobsets (
|
||||
name text not null,
|
||||
id serial not null,
|
||||
project text not null,
|
||||
description text,
|
||||
nixExprInput text, -- name of the jobsetInput containing the Nix or Guix expression
|
||||
@ -76,7 +77,8 @@ create table Jobsets (
|
||||
check ((type = 0) = (nixExprInput is not null and nixExprPath is not null)),
|
||||
check ((type = 1) = (flake is not null)),
|
||||
primary key (project, name),
|
||||
foreign key (project) references Projects(name) on delete cascade on update cascade
|
||||
foreign key (project) references Projects(name) on delete cascade on update cascade,
|
||||
constraint Jobsets_id_unique UNIQUE(id)
|
||||
#ifdef SQLITE
|
||||
,
|
||||
foreign key (project, name, nixExprInput) references JobsetInputs(project, jobset, name)
|
||||
|
Reference in New Issue
Block a user