diff --git a/hsarback/database/data.sql b/hsarback/database/data.sql index c91a7fc..b9f87d6 100644 --- a/hsarback/database/data.sql +++ b/hsarback/database/data.sql @@ -166,3 +166,5 @@ INSERT INTO domain_option (domain_option_name) VALUES ('indexes'); INSERT INTO domain_option (domain_option_name) VALUES ('multiviews'); +INSERT INTO domain_option (domain_option_name) + VALUES ('php'); diff --git a/hsarback/database/database_update.sql b/hsarback/database/database_update.sql index dd855d7..04b41fb 100644 --- a/hsarback/database/database_update.sql +++ b/hsarback/database/database_update.sql @@ -1,80 +1,31 @@ --- Migrate database from version 2.1 to version 2.2 +-- Migrate database from version 2.2 to version 2.3 -- --- domain options --- -CREATE SEQUENCE domain_option_id_seq - INCREMENT BY 1 - NO MAXVALUE - NO MINVALUE - CACHE 1; - -CREATE TABLE domain_option ( - domain_option_id integer DEFAULT nextval(('"domain_option_id_seq"'::text)::regclass) NOT NULL, - domain_option_name character varying(50) NOT NULL -); - -ALTER TABLE ONLY domain_option - ADD CONSTRAINT pk_domain_option PRIMARY KEY (domain_option_id); - -CREATE UNIQUE INDEX domain_option_name_idx ON domain_option USING btree ( domain_option_name ); - -CREATE TABLE domain__domain_option ( - domain_option_id integer NOT NULL, - domain_id integer NOT NULL -); - -ALTER TABLE ONLY domain__domain_option - ADD CONSTRAINT pk_domain__domain_option PRIMARY KEY (domain_option_id, domain_id); - -ALTER TABLE ONLY domain__domain_option - ADD CONSTRAINT domain_option_id_fkey FOREIGN KEY (domain_option_id) - REFERENCES domain_option(domain_option_id) DEFERRABLE; - -ALTER TABLE ONLY domain__domain_option - ADD CONSTRAINT domain_id_fkey FOREIGN KEY (domain_id) - REFERENCES domain(domain_id) DEFERRABLE; -- -- table: domain_option -- -INSERT INTO domain_option (domain_option_name) - VALUES ('backupmxforexternalmx'); -INSERT INTO domain_option (domain_option_name) - VALUES ('greylisting'); INSERT INTO domain_option (domain_option_name) - VALUES ('htdocsfallback'); -INSERT INTO domain_option (domain_option_name) - VALUES ('includes'); -INSERT INTO domain_option (domain_option_name) - VALUES ('indexes'); -INSERT INTO domain_option (domain_option_name) - VALUES ('multiviews'); + VALUES ('php'); -- -- new domain options settings -- --- existing default = ON --- -INSERT INTO domain__domain_option SELECT domain_option_id, domain_id - FROM domain, domain_option - WHERE domain_option.domain_option_name = 'greylisting' ; +-- existing default = On for DW-packet, Off otherwise. +-- INSERT INTO domain__domain_option SELECT domain_option_id, domain_id - FROM domain, domain_option - WHERE domain_option.domain_option_name = 'htdocsfallback' ; -INSERT INTO domain__domain_option SELECT domain_option_id, domain_id - FROM domain, domain_option - WHERE domain_option.domain_option_name = 'includes' ; -INSERT INTO domain__domain_option SELECT domain_option_id, domain_id - FROM domain, domain_option - WHERE domain_option.domain_option_name = 'indexes' ; -INSERT INTO domain__domain_option SELECT domain_option_id, domain_id - FROM domain, domain_option - WHERE domain_option.domain_option_name = 'multiviews' ; + FROM domain + JOIN unixuser on ( domain.domain_owner = unixuser.unixuser_id ) + JOIN packet on ( unixuser.packet_id = packet.packet_id ) + JOIN basepacket on ( packet.bp_id = basepacket.basepacket_id ) + , domain_option + WHERE basepacket.basepacket_code = 'DW/B' + AND domain_option.domain_option_name = 'php' ; +DELETE FROM domain__domain_option USING domain_option, domain + JOIN unixuser on ( domain.domain_owner = unixuser.unixuser_id ) + JOIN packet on ( unixuser.packet_id = packet.packet_id ) + JOIN basepacket on ( packet.bp_id = basepacket.basepacket_id ) + WHERE basepacket.basepacket_code != 'DW/B' + AND domain__domain_option.domain_option_id = domain_option.domain_option_id + AND domain_option.domain_option_name = 'php' ; -- --- existing default = OFF --- -DELETE FROM domain__domain_option USING domain_option - WHERE domain__domain_option.domain_option_id = domain_option.domain_option_id - AND domain_option.domain_option_name = 'backupmxforexternalmx' ; --- --- End of migratino to version 2.2 +-- End of migration to version 2.3 --