From b0ea76d9490cef1f9e77f2a125602bfb139400b7 Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@hostsharing.net>
Date: Wed, 18 Jul 2012 11:00:12 +0200
Subject: [PATCH] DomainOptions Model

---
 hsarback/database/schema.sql |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/hsarback/database/schema.sql b/hsarback/database/schema.sql
index 4ffc9fd..178b0ea 100644
--- a/hsarback/database/schema.sql
+++ b/hsarback/database/schema.sql
@@ -907,4 +907,32 @@
 ALTER TABLE ONLY queue_task
     ADD CONSTRAINT queue_task_user_id_fkey FOREIGN KEY (user_id) REFERENCES unixuser(unixuser_id) ON DELETE SET NULL;
 
+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
+);
+
+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
+); 
+
+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;
+
+ALTER TABLE ONLY domain__domain_option
+    ADD CONSTRAINT domain_id_fkey FOREIGN KEY (domain_id) 
+    	REFERENCES domain(domain_id) DEFERRABLE;
 

--
Gitblit v1.9.3