3 inventory_accno_id int,
11 weightunit varchar(5),
16 insert into def (inventory_accno_id, income_accno_id, expense_accno_id, invnumber, ordnumber, yearend, weightunit, businessnumber, version, curr) select inventory_accno_id, income_accno_id, expense_accno_id, invnumber, ponumber, yearend, weightunit, businessnumber, version, nativecurr from defaults;
18 alter table def rename to defaults;
19 update defaults set version = '1.8.0';
21 -- create a default accno for exchange rate gain and loss
23 select accno into temp from chart where category = 'I' order by accno desc limit 1;
24 update temp set accno = accno + 1;
25 insert into chart (accno) select accno from temp;
26 update chart set description = 'Foreign Exchange Gain', category = 'I', charttype = 'A' where accno = (select accno from temp);
27 update defaults set fxgain_accno_id = (select id from chart where chart.accno = temp.accno);
29 select accno into temp from chart where category = 'E' order by accno desc limit 1;
30 update temp set accno = accno + 1;
31 insert into chart (accno) select accno from temp;
32 update chart set description = 'Foreign Exchange Loss', category = 'E', charttype = 'A' where accno = (select accno from temp);
33 update defaults set fxloss_accno_id = (select id from chart where chart.accno = temp.accno);
36 alter table parts add column bin text;
37 alter table parts alter column onhand set default 0;
38 update parts set onhand = 0 where onhand = NULL;
39 alter table parts add column obsolete bool;
40 alter table parts alter column obsolete set default 'f';
41 update parts set obsolete = 'f';
43 alter table ap rename column vendor to vendor_id;
44 alter table ap add column curr char(3);
46 alter table ar rename column customer to customer_id;
47 alter table ar add column curr char(3);
48 alter table ar add column ordnumber text;
50 alter table acc_trans add column source text;
51 alter table acc_trans add column cleared bool;
52 alter table acc_trans alter column cleared set default 'f';
53 alter table acc_trans add column fx_transaction bool;
54 alter table acc_trans alter column fx_transaction set default 'f';
55 update acc_trans set cleared = 'f', fx_transaction = 'f';
58 id int default nextval('id'),
60 transdate date default current_date,
72 create table orderitems (
81 alter table invoice rename to invoiceold;
82 create table invoice (
83 id int default nextval('id'),
92 assemblyitem bool default 'f'
94 insert into invoice (id, trans_id, parts_id, description, qty, allocated, sellprice, fxsellprice, discount, assemblyitem) select id, trans_id, parts_id, description, qty, allocated, sellprice, sellprice, discount, assemblyitem from invoiceold;
95 update invoice set assemblyitem = 'f' where assemblyitem = NULL;
96 drop table invoiceold;
98 create table exchangerate (