hs.hsadmin/hsarback/database/database_update.sql
2012-10-31 11:37:07 +01:00

32 lines
1.1 KiB
SQL

-- Migrate database from version 2.2 to version 2.3
--
--
-- table: domain_option
--
INSERT INTO domain_option (domain_option_name)
VALUES ('php');
--
-- new domain options settings
--
-- existing default = On for DW-packet, Off otherwise.
--
INSERT INTO domain__domain_option SELECT domain_option_id, domain_id
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' ;
--
-- End of migration to version 2.3
--