summaryrefslogtreecommitdiff
path: root/sql/legacy/Pg-upgrade-2.2.0-2.3.0.sql
blob: edadee6ffed8cc3b18857a9a251a437fdb9883a4 (plain)
  1. --
  2. alter table oe add column quotation bool;
  3. alter table oe alter column quotation set default 'f';
  4. update oe set quotation = '0';
  5. alter table oe add column quonumber text;
  6. --
  7. alter table defaults add column sqnumber text;
  8. alter table defaults add column rfqnumber text;
  9. --
  10. alter table invoice add column serialnumber text;
  11. --
  12. alter table ar add column quonumber text;
  13. create index ar_quonumber_key on ar (lower(quonumber));
  14. alter table ap add column quonumber text;
  15. create index ap_quonumber_key on ap (lower(quonumber));
  16. --
  17. alter table employee add role text;
  18. --
  19. alter table makemodel add column make text;
  20. alter table makemodel add column model text;
  21. update makemodel set make = substr(name,1,strpos(name,':')-1);
  22. update makemodel set model = substr(name,strpos(name,':')+1);
  23. create table temp (parts_id int,make text,model text);
  24. insert into temp (parts_id,make,model) select parts_id,make,model from makemodel;
  25. drop table makemodel;
  26. alter table temp rename to makemodel;
  27. --
  28. create index makemodel_parts_id_key on makemodel (parts_id);
  29. create index makemodel_make_key on makemodel (lower(make));
  30. create index makemodel_model_key on makemodel (lower(model));
  31. --
  32. create table status (trans_id int, formname text, printed bool default 'f', emailed bool default 'f', spoolfile text, chart_id int);
  33. create index status_trans_id_key on status (trans_id);
  34. --
  35. create sequence invoiceid;
  36. select setval('invoiceid', (select max(id) from invoice));
  37. alter table invoice alter column id set default nextval('invoiceid');
  38. --
  39. alter table ar add column intnotes text;
  40. alter table ap add column intnotes text;
  41. alter table oe add column intnotes text;
  42. --
  43. create table department (id int default nextval('id'), description text, role char(1) default 'P');
  44. create index department_id_key on department (id);
  45. --
  46. alter table ar add column department_id int;
  47. alter table ar alter column department_id set default 0;
  48. update ar set department_id = 0;
  49. alter table ap add column department_id int;
  50. alter table ap alter column department_id set default 0;
  51. update ap set department_id = 0;
  52. alter table gl add column department_id int;
  53. alter table gl alter column department_id set default 0;
  54. update gl set department_id = 0;
  55. alter table oe add column department_id int;
  56. alter table oe alter column department_id set default 0;
  57. update oe set department_id = 0;
  58. --
  59. update defaults set version = '2.3.0';