database migration

This commit is contained in:
Peter Hormanns 2017-04-12 19:21:12 +02:00
parent 5c0c111a65
commit d7e8d6825f
2 changed files with 32 additions and 0 deletions

View File

@ -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);

View File

@ -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 ;