summaryrefslogtreecommitdiff
path: root/sql/Pg-upgrade-2.6.18-2.6.19.sql
blob: d8e304f325a64bb13e8a05853c7669ce401a5456 (plain)
  1. ALTER TABLE acc_trans ADD FOREIGN KEY (trans_id) REFERENCES transactions (id);
  2. ALTER TABLE ap ADD PRIMARY KEY (id);
  3. ALTER TABLE ar ADD PRIMARY KEY (id);
  4. ALTER TABLE assembly ADD PRIMARY KEY (id, parts_id);
  5. ALTER TABLE business ADD PRIMARY KEY (id);
  6. ALTER TABLE customer ADD PRIMARY KEY (id);
  7. ALTER TABLE customertax ADD PRIMARY KEY (customer_id, chart_id);
  8. ALTER TABLE defaults ADD PRIMARY KEY (version);
  9. ALTER TABLE department ADD PRIMARY KEY (id);
  10. ALTER TABLE dpt_trans ADD PRIMARY KEY (trans_id);
  11. ALTER TABLE employee ADD PRIMARY KEY (id);
  12. ALTER TABLE exchangerate ADD PRIMARY KEY (curr, transdate);
  13. ALTER TABLE gifi ADD PRIMARY KEY (accno);
  14. ALTER TABLE gl ADD PRIMARY KEY (id);
  15. ALTER TABLE invoice ADD PRIMARY KEY (id);
  16. ALTER TABLE jcitems ADD PRIMARY KEY (id);
  17. ALTER TABLE language ADD PRIMARY KEY (code);
  18. ALTER TABLE makemodel ADD PRIMARY KEY (parts_id);
  19. ALTER TABLE oe ADD PRIMARY KEY (id);
  20. ALTER TABLE orderitems ADD PRIMARY KEY (id);
  21. ALTER TABLE parts ADD PRIMARY KEY (id);
  22. ALTER TABLE partsgroup ADD PRIMARY KEY (id);
  23. ALTER TABLE partstax ADD PRIMARY KEY (parts_id, chart_id);
  24. ALTER TABLE pricegroup ADD PRIMARY KEY (id);
  25. ALTER TABLE project ADD PRIMARY KEY (id);
  26. ALTER TABLE recurringemail ADD PRIMARY KEY (id);
  27. ALTER TABLE recurring ADD PRIMARY KEY (id);
  28. ALTER TABLE recurringprint ADD PRIMARY KEY (id);
  29. ALTER TABLE sic ADD PRIMARY KEY (code);
  30. ALTER TABLE status ADD PRIMARY KEY (trans_id);
  31. ALTER TABLE tax ADD PRIMARY KEY (chart_id);
  32. ALTER TABLE tax ADD FOREIGN KEY (chart_id) REFERENCES chart (id);
  33. ALTER TABLE translation ADD PRIMARY KEY (trans_id, language_code);
  34. ALTER TABLE vendor ADD PRIMARY KEY (id);
  35. ALTER TABLE vendortax ADD PRIMARY KEY (vendor_id, chart_id);
  36. ALTER TABLE warehouse ADD PRIMARY KEY (id);
  37. ALTER TABLE yearend ADD PRIMARY KEY (trans_id);
  38. LOCK inventory in EXCLUSIVE mode;
  39. ALTER TABLE inventory ADD COLUMN entry_id bigint;
  40. CREATE SEQUENCE inventory_entry_id_seq;
  41. ALTER TABLE inventory ALTER COLUMN entry_id
  42. SET DEFAULT nextval('inventory_entry_id_seq');
  43. UPDATE inventory SET entry_id = nextval('inventory_entry_id_seq');
  44. ALTER TABLE inventory ADD PRIMARY key (entry_id);
  45. LOCK partscustomer IN EXCLUSIVE MODE;
  46. ALTER TABLE partscustomer ADD COLUMN entry_id int;
  47. CREATE SEQUENCE partscustomer_entry_id_seq;
  48. ALTER TABLE partscustomer ALTER COLUMN entry_id
  49. SET DEFAULT nextval('partscustomer_entry_id_seq');
  50. UPDATE partscustomer SET entry_id = nextval('partscustomer_entry_id_seq');
  51. ALTER TABLE partscustomer ADD PRIMARY KEY (entry_id);
  52. LOCK partsvendor IN EXCLUSIVE MODE;
  53. ALTER TABLE partsvendor ADD COLUMN entry_id int;
  54. CREATE SEQUENCE partsvendor_entry_id_seq;
  55. ALTER TABLE partsvendor ALTER COLUMN entry_id
  56. SET DEFAULT nextval('partsvendor_entry_id_seq');
  57. UPDATE partsvendor SET entry_id = nextval('partsvendor_entry_id_seq');
  58. ALTER TABLE partsvendor ADD PRIMARY KEY (entry_id);
  59. LOCK audittrail IN EXCLUSIVE MODE;
  60. ALTER TABLE audittrail ADD COLUMN entry_id int;
  61. CREATE SEQUENCE audittrail_entry_id_seq ;
  62. ALTER TABLE audittrail ALTER COLUMN entry_id
  63. SET DEFAULT nextval('audittrail_entry_id_seq');
  64. UPDATE audittrail SET entry_id = nextval('audittrail_entry_id_seq');
  65. ALTER TABLE audittrail ADD PRIMARY KEY (entry_id);
  66. LOCK shipto IN EXCLUSIVE MODE;
  67. ALTER TABLE shipto ADD COLUMN entry_id int;
  68. CREATE SEQUENCE shipto_entry_id_seq ;
  69. ALTER TABLE shipto ALTER COLUMN entry_id
  70. SET DEFAULT nextval('shipto_entry_id_seq');
  71. UPDATE shipto SET entry_id = nextval('shipto_entry_id_seq');
  72. ALTER TABLE shipto ADD PRIMARY KEY (entry_id);
  73. CREATE TABLE taxmodule (
  74. taxmodule_id serial PRIMARY KEY,
  75. taxmodulename text NOT NULL
  76. );
  77. INSERT INTO taxmodule (
  78. taxmodule_id, taxmodulename
  79. ) VALUES (
  80. 1, 'Simple'
  81. );
  82. LOCK tax IN EXCLUSIVE MODE;
  83. ALTER TABLE tax ADD COLUMN pass int DEFAULT 0;
  84. UPDATE tax SET pass = 0;
  85. ALTER TABLE tax ALTER COLUMN pass SET NOT NULL;
  86. ALTER TABLE tax ADD COLUMN taxmodule_id int REFERENCES taxmodule DEFAULT 1;
  87. UPDATE tax SET taxmodule_id = 1;
  88. ALTER TABLE tax ALTER COLUMN taxmodule_id SET NOT NULL;