diff --git a/hsarback/database/database_update.sql b/hsarback/database/database_update.sql index e6fb286..9d462ec 100644 --- a/hsarback/database/database_update.sql +++ b/hsarback/database/database_update.sql @@ -9,11 +9,16 @@ CREATE TABLE domain_option ( domain_option_name character varying(50) NOT NULL ); +ALTER TABLE ONLY domain_option + ADD CONSTRAINT domain_option_uniq UNIQUE (domain_option_id); + CREATE TABLE domain__domain_option ( - domain_option_id integer NOT NULL; - domain_id integer NOT NULL; + domain_option_id integer NOT NULL, + domain_id integer NOT NULL ); +CREATE UNIQUE INDEX unique_domain__domain_option ON domain__domain_option USING btree (domain_option_id, domain_id); + ALTER TABLE ONLY domain__domain_option ADD CONSTRAINT domain_option_id_fkey FOREIGN KEY (domain_option_id) REFERENCES domain_option(domain_option_id) DEFERRABLE;