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