From 89493989c124c24cc6f22de978eef0df72800e23 Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@jalin.de>
Date: Tue, 30 Apr 2013 12:03:19 +0200
Subject: [PATCH] remove not needed database tables

---
 hsarback/database/schema.sql |   73 ++++++------------------------------
 1 files changed, 12 insertions(+), 61 deletions(-)

diff --git a/hsarback/database/schema.sql b/hsarback/database/schema.sql
index 33d435f..089fbdd 100644
--- a/hsarback/database/schema.sql
+++ b/hsarback/database/schema.sql
@@ -5,13 +5,14 @@
 CREATE TABLE bank_account (
     bank_account_id integer DEFAULT nextval(('"bank_account_bank_account_id_seq"'::text)::regclass) NOT NULL,
     bp_id integer NOT NULL,
-    autodebit_ga boolean NOT NULL DEFAULT false,
-    autodebit_ar boolean NOT NULL DEFAULT false,
-    autodebit_op boolean NOT NULL DEFAULT false,
-    bank_customer character varying(50) NOT NULL DEFAULT '',
-    bank_account character varying(10) NOT NULL DEFAULT '',
-    bank_code character varying(8) NOT NULL DEFAULT '',
-    bank_name character varying(50) NOT NULL DEFAULT ''
+    autodebit_ga boolean NOT NULL,
+    autodebit_ar boolean NOT NULL,
+    autodebit_op boolean NOT NULL,
+    bank_customer character varying(50),
+    bank_account character varying(10),
+    bank_code character varying(8),
+    bank_name character varying(50),
+    CONSTRAINT ckt_bank_account CHECK (((((((bank_customer IS NOT NULL) AND (bank_account IS NOT NULL)) AND (bank_code IS NOT NULL)) AND (bank_name IS NOT NULL)) AND (((autodebit_ga = true) OR (autodebit_ar = true)) OR (autodebit_op = true))) OR (((autodebit_ga = false) AND (autodebit_ar = false)) AND (autodebit_op = false))))
 );
 
 
@@ -76,35 +77,6 @@
 
 
 --
--- Name: billdata; Type: TABLE; Schema: public; Owner: -; Tablespace: 
---
-
-CREATE TABLE billdata (
-    billdata_id integer DEFAULT nextval(('"billdata_billdata_id_seq"'::text)::regclass) NOT NULL,
-    bp_id integer NOT NULL,
-    tariff_domain_discount_since date,
-    tariff_domain_discount_until date,
-    tariff_traffic_discount_since date,
-    tariff_traffic_discount_until date,
-    tariff_quota_discount_since date,
-    tariff_quota_discount_until date,
-    tariff_discount_since date,
-    tariff_discount_until date
-);
-
-
---
--- Name: billdata_billdata_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE billdata_billdata_id_seq
-    INCREMENT BY 1
-    NO MAXVALUE
-    NO MINVALUE
-    CACHE 1;
-
-
---
 -- Name: business_partner; Type: TABLE; Schema: public; Owner: -; Tablespace: 
 --
 
@@ -156,10 +128,12 @@
     include_quantity integer NOT NULL,
     admin_only boolean NOT NULL,
     CONSTRAINT ckt_component CHECK (
-    	(min_quantity <= max_quantity) AND 
+    	(0 <= min_quantity) AND 
     	(min_quantity <= default_quantity) AND 
     	(default_quantity <= max_quantity) AND 
-    	(include_quantity <= max_quantity) AND 
+    	(include_quantity <= default_quantity) AND 
+    	(0 <= include_quantity) AND 
+    	(mod(min_quantity, increment_quantity) = 0) AND 
     	(mod(max_quantity, increment_quantity) = 0) AND 
     	(mod(default_quantity, increment_quantity) = 0) AND 
     	(mod(include_quantity, increment_quantity) = 0)
@@ -563,14 +537,6 @@
 
 
 --
--- Name: pk_billdata; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
---
-
-ALTER TABLE ONLY billdata
-    ADD CONSTRAINT pk_billdata PRIMARY KEY (billdata_id);
-
-
---
 -- Name: pk_business_partner; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
 --
 
@@ -677,13 +643,6 @@
 --
 
 CREATE UNIQUE INDEX basepacket_in_1 ON basepacket USING btree (basepacket_code);
-
-
---
--- Name: billdata_in_1; Type: INDEX; Schema: public; Owner: -; Tablespace: 
---
-
-CREATE UNIQUE INDEX billdata_in_1 ON billdata USING btree (bp_id);
 
 
 --
@@ -853,14 +812,6 @@
 
 ALTER TABLE ONLY component
     ADD CONSTRAINT fk_bcomp_bpack FOREIGN KEY (basepacket_id) REFERENCES basepacket(basepacket_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
-
-
---
--- Name: fk_billdata_reference_business; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY billdata
-    ADD CONSTRAINT fk_billdata_reference_business FOREIGN KEY (bp_id) REFERENCES business_partner(bp_id) ON UPDATE RESTRICT ON DELETE RESTRICT;
 
 
 --

--
Gitblit v1.9.0-SNAPSHOT