------------------------
-- migration-020-021.sql
------------------------

-- Translate the AUTHORIZATION_ROLE value ADMIN to 'INSTANCE_ADMIN' and 'GROUP_ADMIN' 

ALTER DOMAIN AUTHORIZATION_ROLE DROP CONSTRAINT AUTHORIZATION_ROLE_CHECK;
ALTER DOMAIN AUTHORIZATION_ROLE ADD CONSTRAINT AUTHORIZATION_ROLE_CHECK CHECK (VALUE IN ('ADMIN', 'USER', 'OBSERVER', 'ETL_SERVER'));

-- Modify the UK of the SAMPLES table

ALTER TABLE SAMPLES DROP CONSTRAINT SAMP_BK_UK;

ALTER TABLE SAMPLES ADD CONSTRAINT SAMP_BK_DBIN_UK UNIQUE(SATY_ID,CODE,DBIN_ID);
ALTER TABLE SAMPLES ADD CONSTRAINT SAMP_BK_GROU_UK UNIQUE(SATY_ID,CODE,GROU_ID);


