| | |
| | | CREATE SEQUENCE domain_option_id_seq |
| | | INCREMENT BY 1 |
| | | NO MAXVALUE |
| | | NO MINVALUE |
| | | CACHE 1; |
| | | -- Migrate database from version 2.2 to version 2.3 |
| | | -- |
| | | |
| | | 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 |
| | | --- Add domain option "php". |
| | | |
| | | INSERT INTO domain_option (domain_option_name) |
| | | VALUES ('php'); |
| | | |
| | | --- Set default values for pacs |
| | | |
| | | 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' ; |
| | | |
| | | --- 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 values (1, 'Default Price List'); |
| | | |
| | | create table customer_price_list_mapping ( |
| | | customer integer references business_partner(bp_id), |
| | | price_list integer references price_list(id) |
| | | ); |
| | | insert into customer_price_list_mapping (select bp_id, 1 from business_partner); |
| | | |
| | | ALTER TABLE ONLY domain_option |
| | | ADD CONSTRAINT domain_option_uniq UNIQUE (domain_option_id); |
| | | 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); |
| | | |
| | | CREATE UNIQUE INDEX ON domain_option ( domain_option_name ); |
| | | |
| | | CREATE TABLE domain__domain_option ( |
| | | domain_option_id integer NOT NULL, |
| | | domain_id integer NOT NULL |
| | | ); |
| | | |
| | | CREATE UNIQUE INDEX unique_domain__domain_option ON domain__domain_option USING btree (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; |
| | | |
| | | update domain set domain_since=domain_filed; |
| | | |
| | | alter table domain drop column domain_free; |
| | | alter table domain drop column domain_until; |
| | | alter table domain drop column domain_filed; |
| | | alter table domain drop column domain_reminder; |
| | | alter table domain drop column domain_template; |
| | | alter table domain drop column domain_status; |
| | | alter table domain drop column domain_status_changed; |
| | | |
| | | |
| | | |
| | | -- |
| | | -- End of migration to version 2.3 |
| | | -- |