repair test data for schema updates

This commit is contained in:
Peter Hormanns 2013-04-23 17:39:58 +02:00
parent f32fd2c6b7
commit f572d9cfdd
2 changed files with 43 additions and 30 deletions

View File

@ -1,10 +1,12 @@
--
-- Table: basepacket
--
INSERT INTO basepacket (basepacket_code, description, sorting, valid)
VALUES ('DW/B', 'Dynamic-Web/Base', 100, true);
INSERT INTO basepacket (basepacket_code, description, sorting, valid)
VALUES ('SW/B', 'Static-Web/Base', 200, true);
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
VALUES ('DW/B', 'Dynamic-Web/Base', 200, true, 100);
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
VALUES ('SW/B', 'Static-Web/Base', 300, true, 200);
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
VALUES ('WEB', 'Web/Base', 100, true, 300);
--
-- Table: basecomponent
@ -14,35 +16,45 @@ INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
VALUES ('QUOTA', 'Festplattenspeicherplatz in MB', 200, true);
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
VALUES ('TOMCAT', 'Nutzung eines eigenen Tomcat-Servers', 300, true);
VALUES ('DAEMON', 'Nutzung eines eigenen Servers/Daemons', 300, true);
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
VALUES ('ZOPE', 'Nutzung eines eigenen Zope-Servers', 310, true);
VALUES ('MIRROR', 'Echtzeitspiegelung der Daten', 400, true);
INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
VALUES ('APACHE', 'Nutzung eines eigenen Apache-Servers', 310, true);
VALUES ('BACKUP', 'Nächtliches Backup', 500, true);
--
-- Table: component
--
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
SELECT basepacket_id, basecomponent_id, 128, 40960, 128, 128, 128, false FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='QUOTA';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
SELECT basepacket_id, basecomponent_id, 512, 40960, 512, 512, 512, false FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='QUOTA';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
SELECT basepacket_id, basecomponent_id, 2, 40960, 2, 2, 2, false FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='TRAFFIC';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
SELECT basepacket_id, basecomponent_id, 4, 40960, 4, 4, 4, false FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='TRAFFIC';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
SELECT basepacket_id, basecomponent_id, 0, 4, 0, 1, 0, false FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='TOMCAT';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
SELECT basepacket_id, basecomponent_id, 0, 0, 0, 1, 0, false FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='TOMCAT';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
SELECT basepacket_id, basecomponent_id, 0, 4, 0, 1, 0, false FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='ZOPE';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
SELECT basepacket_id, basecomponent_id, 0, 0, 0, 1, 0, false FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='ZOPE';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
SELECT basepacket_id, basecomponent_id, 0, 4, 0, 1, 0, false FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='APACHE';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only)
SELECT basepacket_id, basecomponent_id, 0, 0, 0, 1, 0, false FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='APACHE';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 128, 40960, 128, 128, 128, false, 101 FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='QUOTA';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 512, 40960, 512, 512, 512, false, 201 FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='QUOTA';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 512, 40960, 512, 512, 0, false, 301 FROM basepacket, basecomponent WHERE basepacket_code='WEB' AND basecomponent_code='QUOTA';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 2, 40960, 2, 2, 2, false, 102 FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='TRAFFIC';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 4, 40960, 4, 4, 4, false, 202 FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='TRAFFIC';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 5, 40960, 5, 5, 0, false, 302 FROM basepacket, basecomponent WHERE basepacket_code='WEB' AND basecomponent_code='TRAFFIC';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 0, 4, 0, 1, 0, false, 103 FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='DAEMON';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 0, 0, 0, 1, 0, false, 203 FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='DAEMON';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 0, 4, 0, 1, 0, false, 303 FROM basepacket, basecomponent WHERE basepacket_code='WEB' AND basecomponent_code='DAEMON';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 104 FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='MIRROR';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 204 FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='MIRROR';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 304 FROM basepacket, basecomponent WHERE basepacket_code='WEB' AND basecomponent_code='MIRROR';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 105 FROM basepacket, basecomponent WHERE basepacket_code='DW/B' AND basecomponent_code='BACKUP';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 205 FROM basepacket, basecomponent WHERE basepacket_code='SW/B' AND basecomponent_code='BACKUP';
INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 305 FROM basepacket, basecomponent WHERE basepacket_code='WEB' AND basecomponent_code='BACKUP';
--
-- Table: business_partner
@ -59,8 +71,8 @@ INSERT INTO contact (bp_id, salut, first_name, last_name, firma, email)
--
-- table: bank_account
--
INSERT INTO bank_account (bp_id)
SELECT bp_id FROM business_partner WHERE member_id=10000;
INSERT INTO bank_account (bp_id, autodebit_ga, autodebit_ar, autodebit_op)
SELECT bp_id, true, true, true FROM business_partner WHERE member_id=10000;
--
-- table: billdata

View File

@ -123,7 +123,8 @@ CREATE TABLE business_partner (
uid_vat character varying(20),
CONSTRAINT ckc_member_id_business CHECK (((member_id >= 10000) AND (member_id <= 99999))),
CONSTRAINT ckc_shares_signed_business CHECK ((shares_signed >= 0)),
CONSTRAINT ckt_business_partner CHECK ( ( ((member_since IS NULL) AND (member_until IS NULL)) OR ((member_since IS NOT NULL) AND (member_until IS NULL)) OR ((member_since IS NOT NULL) AND (member_until IS NOT NULL) AND (member_since < member_until)) ) AND ((member_code)::text ~~ 'hsh00-%'::text))
CONSTRAINT ckt_business_partner CHECK ( ( ((member_since IS NULL) AND (member_until IS NULL)) OR ((member_since IS NOT NULL) AND (member_until IS NULL)) OR ((member_since IS NOT NULL) AND (member_until IS NOT NULL) AND (member_since < member_until)) ) AND ((member_code)::text ~~ 'hsh00-%'::text)),
UNIQUE (bp_id)
);