Merge remote-tracking branch 'origin/master'

This commit is contained in:
Michael Hierweck 2012-10-31 13:16:59 +01:00
commit 2803fcf81a
2 changed files with 21 additions and 68 deletions

View File

@ -166,3 +166,5 @@ INSERT INTO domain_option (domain_option_name)
VALUES ('indexes'); VALUES ('indexes');
INSERT INTO domain_option (domain_option_name) INSERT INTO domain_option (domain_option_name)
VALUES ('multiviews'); VALUES ('multiviews');
INSERT INTO domain_option (domain_option_name)
VALUES ('php');

View File

@ -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 -- table: domain_option
-- --
INSERT INTO domain_option (domain_option_name) INSERT INTO domain_option (domain_option_name)
VALUES ('backupmxforexternalmx'); VALUES ('php');
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');
-- --
-- new domain options settings -- new domain options settings
-- --
-- existing default = ON -- 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 = 'greylisting' ;
INSERT INTO domain__domain_option SELECT domain_option_id, domain_id INSERT INTO domain__domain_option SELECT domain_option_id, domain_id
FROM domain, domain_option FROM domain
WHERE domain_option.domain_option_name = 'htdocsfallback' ; JOIN unixuser on ( domain.domain_owner = unixuser.unixuser_id )
INSERT INTO domain__domain_option SELECT domain_option_id, domain_id JOIN packet on ( unixuser.packet_id = packet.packet_id )
FROM domain, domain_option JOIN basepacket on ( packet.bp_id = basepacket.basepacket_id )
WHERE domain_option.domain_option_name = 'includes' ; , domain_option
INSERT INTO domain__domain_option SELECT domain_option_id, domain_id WHERE basepacket.basepacket_code = 'DW/B'
FROM domain, domain_option AND domain_option.domain_option_name = 'php' ;
WHERE domain_option.domain_option_name = 'indexes' ; DELETE FROM domain__domain_option USING domain_option, domain
INSERT INTO domain__domain_option SELECT domain_option_id, domain_id JOIN unixuser on ( domain.domain_owner = unixuser.unixuser_id )
FROM domain, domain_option JOIN packet on ( unixuser.packet_id = packet.packet_id )
WHERE domain_option.domain_option_name = 'multiviews' ; 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 -- End of migration to version 2.3
--
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
-- --