57 lines
2.4 KiB
SQL
57 lines
2.4 KiB
SQL
-- 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 = 'PAC/DW'
|
|
-- 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 != 'PAC/DW'
|
|
-- AND domain__domain_option.domain_option_id = domain_option.domain_option_id
|
|
-- AND domain_option.domain_option_name = 'php' ;
|
|
|
|
--- Updates related to HSBilling
|
|
|
|
UPDATE bank_account SET autodebit_ar = false WHERE autodebit_ar IS NULL;
|
|
ALTER TABLE bank_account ALTER COLUMN autodebit_ar SET NOT NULL;
|
|
|
|
UPDATE bank_account SET autodebit_ga = false WHERE autodebit_ga IS NULL;
|
|
ALTER TABLE bank_account ALTER COLUMN autodebit_ga SET NOT NULL;
|
|
|
|
UPDATE bank_account SET autodebit_op = false WHERE autodebit_op IS NULL;
|
|
ALTER TABLE bank_account ALTER COLUMN autodebit_op SET NOT NULL;
|
|
|
|
ALTER TABLE basepacket ADD COLUMN article_number integer NOT NULL DEFAULT 1;
|
|
ALTER TABLE basepacket ALTER COLUMN article_number DROP DEFAULT;
|
|
|
|
ALTER TABLE component ADD COLUMN article_number integer NOT NULL DEFAULT 1;
|
|
ALTER TABLE component ALTER COLUMN article_number DROP DEFAULT;
|
|
|
|
CREATE TABLE price_list (
|
|
id serial PRIMARY KEY,
|
|
name varchar(20)
|
|
);
|
|
INSERT INTO price_list (name) VALUES ('Default Price List');
|
|
|
|
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)
|
|
);
|
|
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)
|
|
);
|
|
INSERT INTO price VALUES (1, 0, 0, 0, 1);
|
|
|