2013-04-25 17:19:14 +02:00
|
|
|
-- 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
|
2013-04-29 18:49:16 +02:00
|
|
|
-- WHERE basepacket.basepacket_code = 'PAC/DW'
|
2013-04-25 17:19:14 +02:00
|
|
|
-- 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 )
|
2013-04-29 18:49:16 +02:00
|
|
|
-- WHERE basepacket.basepacket_code != 'PAC/DW'
|
2013-04-25 17:19:14 +02:00
|
|
|
-- AND domain__domain_option.domain_option_id = domain_option.domain_option_id
|
|
|
|
-- AND domain_option.domain_option_name = 'php' ;
|
2013-04-17 18:02:19 +02:00
|
|
|
|
|
|
|
--- Updates related to HSBilling
|
|
|
|
|
2013-04-25 17:19:14 +02:00
|
|
|
UPDATE bank_account SET autodebit_ar = false WHERE autodebit_ar IS NULL;
|
|
|
|
ALTER TABLE bank_account ALTER COLUMN autodebit_ar SET NOT NULL;
|
2013-04-17 18:02:19 +02:00
|
|
|
|
2013-04-25 17:19:14 +02:00
|
|
|
UPDATE bank_account SET autodebit_ga = false WHERE autodebit_ga IS NULL;
|
|
|
|
ALTER TABLE bank_account ALTER COLUMN autodebit_ga SET NOT NULL;
|
2013-04-17 18:02:19 +02:00
|
|
|
|
2013-04-25 17:19:14 +02:00
|
|
|
UPDATE bank_account SET autodebit_op = false WHERE autodebit_op IS NULL;
|
|
|
|
ALTER TABLE bank_account ALTER COLUMN autodebit_op SET NOT NULL;
|
2013-04-17 18:02:19 +02:00
|
|
|
|
2013-04-25 17:19:14 +02:00
|
|
|
ALTER TABLE basepacket ADD COLUMN article_number integer NOT NULL DEFAULT 1;
|
|
|
|
ALTER TABLE basepacket ALTER COLUMN article_number DROP DEFAULT;
|
2013-04-17 18:02:19 +02:00
|
|
|
|
2013-04-25 17:19:14 +02:00
|
|
|
ALTER TABLE component ADD COLUMN article_number integer NOT NULL DEFAULT 1;
|
|
|
|
ALTER TABLE component ALTER COLUMN article_number DROP DEFAULT;
|
2013-04-17 18:02:19 +02:00
|
|
|
|
2013-04-25 17:19:14 +02:00
|
|
|
CREATE TABLE price_list (
|
|
|
|
id serial PRIMARY KEY,
|
2013-04-17 18:02:19 +02:00
|
|
|
name varchar(20)
|
|
|
|
);
|
2013-04-25 17:19:14 +02:00
|
|
|
INSERT INTO price_list (name) VALUES ('Default Price List');
|
2013-04-17 18:02:19 +02:00
|
|
|
|
2013-04-25 17:19:14 +02:00
|
|
|
CREATE TABLE customer_price_list_mapping (
|
|
|
|
customer integer REFERENCES business_partner(bp_id),
|
|
|
|
price_list integer REFERENCES price_list(id),
|
|
|
|
PRIMARY KEY (customer, price_list)
|
2013-04-17 18:02:19 +02:00
|
|
|
);
|
2013-04-25 17:19:14 +02:00
|
|
|
INSERT INTO customer_price_list_mapping (SELECT bp_id, 1 FROM business_partner);
|
|
|
|
|
|
|
|
CREATE TABLE price (
|
|
|
|
id serial PRIMARY KEY,
|
|
|
|
article_number integer NOT NULL,
|
|
|
|
price decimal(10, 2) NOT NULL,
|
|
|
|
vat decimal(4,2) NOT NULL,
|
|
|
|
price_list integer REFERENCES price_list(id)
|
2013-04-17 18:02:19 +02:00
|
|
|
);
|
2013-04-25 17:19:14 +02:00
|
|
|
INSERT INTO price VALUES (1, 0, 0, 0, 1);
|
2013-04-17 18:02:19 +02:00
|
|
|
|