2012-07-17 18:35:25 +02:00
|
|
|
CREATE SEQUENCE domain_option_id_seq
|
|
|
|
INCREMENT BY 1
|
|
|
|
NO MAXVALUE
|
|
|
|
NO MINVALUE
|
|
|
|
CACHE 1;
|
|
|
|
|
|
|
|
CREATE TABLE domain_option (
|
|
|
|
domain_option_id integer DEFAULT nextval(('"domain_option_id_seq"'::text)::regclass) NOT NULL,
|
|
|
|
domain_option_name character varying(50) NOT NULL
|
|
|
|
);
|
|
|
|
|
2012-07-18 10:50:00 +02:00
|
|
|
ALTER TABLE ONLY domain_option
|
|
|
|
ADD CONSTRAINT domain_option_uniq UNIQUE (domain_option_id);
|
|
|
|
|
2012-07-17 18:35:25 +02:00
|
|
|
CREATE TABLE domain__domain_option (
|
2012-07-18 10:50:00 +02:00
|
|
|
domain_option_id integer NOT NULL,
|
|
|
|
domain_id integer NOT NULL
|
2012-07-17 18:35:25 +02:00
|
|
|
);
|
|
|
|
|
2012-07-18 10:50:00 +02:00
|
|
|
CREATE UNIQUE INDEX unique_domain__domain_option ON domain__domain_option USING btree (domain_option_id, domain_id);
|
|
|
|
|
2012-07-17 18:35:25 +02:00
|
|
|
ALTER TABLE ONLY domain__domain_option
|
|
|
|
ADD CONSTRAINT domain_option_id_fkey FOREIGN KEY (domain_option_id)
|
|
|
|
REFERENCES domain_option(domain_option_id) DEFERRABLE;
|
|
|
|
|
|
|
|
ALTER TABLE ONLY domain__domain_option
|
|
|
|
ADD CONSTRAINT domain_id_fkey FOREIGN KEY (domain_id)
|
|
|
|
REFERENCES domain(domain_id) DEFERRABLE;
|