enforce unique content generator names in database

Set a uniqueness constraint on the content generator name in the
database.

Prior to this change, we were only enforcing this in the hub application
layer. Configure this in postgres for safety.
This commit is contained in:
Ken Dreyer 2018-11-14 14:16:11 -07:00 committed by Tomas Kopecek
parent ee47301987
commit f5a845be14
2 changed files with 5 additions and 1 deletions

View file

@ -257,7 +257,7 @@ INSERT INTO volume (id, name) VALUES (0, 'DEFAULT');
-- data for content generators
CREATE TABLE content_generator (
id SERIAL PRIMARY KEY,
name TEXT
name TEXT UNIQUE NOT NULL
) WITHOUT OIDS;
-- here we track the built packages