HSAdmin Backend Domains, E-Mail, Datenbanken
Michael Hierweck
2013-04-17 78a525fcc6be48b5c977e7e0f7de8f90a11310ed
commit | author | age
e5fe2a 1 -- Migrate database from version 2.2 to version 2.3
b127d6 2 --
PB 3
78a525 4 --- Add domain option "php".
MH 5
b127d6 6 INSERT INTO domain_option (domain_option_name)
e5fe2a 7     VALUES ('php');
78a525 8
MH 9 --- Set default values for pacs
10
b127d6 11 INSERT INTO domain__domain_option SELECT domain_option_id, domain_id
e5fe2a 12     FROM domain
PB 13             JOIN unixuser on ( domain.domain_owner = unixuser.unixuser_id ) 
14             JOIN packet on ( unixuser.packet_id = packet.packet_id ) 
15             JOIN basepacket on ( packet.bp_id = basepacket.basepacket_id )
16         , domain_option
17     WHERE basepacket.basepacket_code = 'DW/B'  
18         AND domain_option.domain_option_name = 'php' ;
19 DELETE FROM domain__domain_option USING domain_option, domain
20         JOIN unixuser on ( domain.domain_owner = unixuser.unixuser_id ) 
21         JOIN packet on ( unixuser.packet_id = packet.packet_id ) 
22         JOIN basepacket on ( packet.bp_id = basepacket.basepacket_id )
23     WHERE basepacket.basepacket_code != 'DW/B'
24         AND domain__domain_option.domain_option_id = domain_option.domain_option_id
25         AND domain_option.domain_option_name = 'php' ;
78a525 26
MH 27 --- Updates related to HSBilling
28
29 update bank_account set autodebit_ar = false where autodebit_ar is null;
30 alter table bank_account alter column autodebit_ar set not null;
31
32 update bank_account set autodebit_ga = false where autodebit_ga is null;
33 alter table bank_account alter column autodebit_ga set not null;
34
35 update bank_account set autodebit_op = false where autodebit_op is null;
36 alter table bank_account alter column autodebit_op set not null;
37
38 alter table basepacket add column article_number integer not null default 1;
39 alter table basepacket alter column article_number drop default;
40
41 alter table component add column article_number integer not null default 1;
42 alter table component alter column article_number drop default;
43
44 create table price_list (
45   id serial primary key,                                                                   
46   name varchar(20)
47 );       
48 insert into price_list values (1, 'Default Price List');
49
50 create table customer_price_list_mapping (
51   customer integer references business_partner(bp_id),
52   price_list integer references price_list(id)
53 );
54 insert into customer_price_list_mapping (select bp_id, 1 from business_partner);
55
56 create table price (                                                                
57   id serial primary key,
58         article_number integer not null,
59         price decimal(10, 2) not null,
60         vat decimal(4,2) not null,
61         price_list integer references price_list(id)                                             
62 );
63 insert into price values (1, 0, 0, 0, 1); 
64
b127d6 65 --
e5fe2a 66 -- End of migration to version 2.3
b127d6 67 --