From d7e8d6825f0883cbf2b6280ca99629a06fabc47c Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Wed, 12 Apr 2017 19:21:12 +0200 Subject: [PATCH] database migration --- hsarback/database/database_update.sql | 30 +++++++++++++++++++++++++++ hsarback/database/dropschema.sql | 2 ++ 2 files changed, 32 insertions(+) diff --git a/hsarback/database/database_update.sql b/hsarback/database/database_update.sql index 8935755..2a8bc78 100644 --- a/hsarback/database/database_update.sql +++ b/hsarback/database/database_update.sql @@ -56,3 +56,33 @@ ALTER TABLE business_partner DROP CONSTRAINT ckc_shares_signed_business; ALTER TABLE business_partner DROP COLUMN shares_updated ; ALTER TABLE business_partner DROP COLUMN shares_signed ; + +CREATE TABLE pac_administration ( + pac_administration_id integer NOT NULL, + contact_id integer NOT NULL, + pac_id integer NOT NULL +); + +CREATE SEQUENCE pac_administration_pac_administration_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE pac_administration_pac_administration_id_seq OWNED BY pac_administration.pac_administration_id; + +ALTER TABLE ONLY pac_administration + ALTER COLUMN pac_administration_id SET DEFAULT nextval('pac_administration_pac_administration_id_seq'::regclass); + +ALTER TABLE ONLY pac_administration + ADD CONSTRAINT pk_pac_administration PRIMARY KEY (pac_administration_id); + +ALTER TABLE ONLY pac_administration + ADD CONSTRAINT pac_administration_contact_ref FOREIGN KEY (contact_id) REFERENCES contact(contact_id); + +ALTER TABLE ONLY pac_administration + ADD CONSTRAINT pac_administration_pac_ref FOREIGN KEY (pac_id) REFERENCES packet(packet_id); + +ALTER TABLE ONLY contact + ADD COLUMN login character varying(40); diff --git a/hsarback/database/dropschema.sql b/hsarback/database/dropschema.sql index cb73476..952fae5 100644 --- a/hsarback/database/dropschema.sql +++ b/hsarback/database/dropschema.sql @@ -23,6 +23,7 @@ DROP TABLE queue_task ; DROP SEQUENCE queue_task_id_seq ; DROP TABLE unixuser CASCADE ; DROP SEQUENCE unixuser_unixuser_id_seq ; +DROP TABLE pac_administration CASCADE ; DROP TABLE packet_component ; DROP TABLE component ; DROP TABLE basecomponent ; @@ -41,3 +42,4 @@ DROP SEQUENCE packet_component_id_seq ; DROP SEQUENCE component_id_seq ; DROP TABLE contactrole_ref CASCADE ; DROP TABLE role CASCADE ; +