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:
parent
ee47301987
commit
f5a845be14
2 changed files with 5 additions and 1 deletions
|
|
@ -77,4 +77,8 @@ INSERT INTO user_krb_principals ( SELECT id, krb_principal FROM users WHERE user
|
|||
|
||||
ALTER TABLE users DROP COLUMN krb_principal;
|
||||
|
||||
-- Disallow duplicate content generator names
|
||||
ALTER TABLE content_generator ADD UNIQUE (name);
|
||||
ALTER TABLE content_generator ALTER COLUMN name SET NOT NULL;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue