#1159 enforce unique content generator names in database
Merged 2 years ago by tkopecek. Opened 3 years ago by ktdreyer.
ktdreyer/koji unique-cgs  into  master

@@ -77,4 +77,8 @@ 

  

  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;

file modified
+1 -1
@@ -257,7 +257,7 @@ 

  -- 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

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.

rebased onto 48d8e28b670ec5212b3c753aa764970ea4409224

3 years ago

rebased onto 2c3ebda9f9f6c93db78a20d7638885f2aa6e08dc

3 years ago

rebased onto 54e515f7ef39a62ba05b8a0aa26ed3fd096148d9

3 years ago

@ktdreyer I've created #1668 for this - can you update it, please, for 1.19?

I've created new PR for 1.19: #1692

rebased onto b1237a2

2 years ago

Whoops I missed your comment and I did rebase this one.

Commit 23cd44b fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago

@jcupova - this one is exactly same as #1692 which, I've closed as a dup.