summaryrefslogtreecommitdiff
path: root/sql/Oracle-upgrade-1.8.4-1.8.5.sql
blob: d228b9ee4ac8a2ca3cbdb11353206137aeee7d18 (plain)
  1. --
  2. ALTER TABLE customer ADD (customernumber VARCHAR2(40));
  3. UPDATE customer SET customernumber = businessnumber;
  4. ALTER TABLE customer DROP COLUMN businessnumber;
  5. CREATE INDEX customer_customernumber_key ON customer (customernumber);
  6. --
  7. ALTER TABLE vendor ADD (vendornumber VARCHAR2(40));
  8. UPDATE vendor SET vendornumber = businessnumber;
  9. ALTER TABLE vendor DROP COLUMN businessnumber;
  10. CREATE INDEX vendor_vendornumber_key ON vendor (vendornumber);
  11. --
  12. CREATE TABLE employee (
  13. id INTEGER,
  14. login VARCHAR2(20),
  15. name VARCHAR2(35),
  16. addr1 VARCHAR2(35),
  17. addr2 VARCHAR2(35),
  18. addr3 VARCHAR2(35),
  19. addr4 VARCHAR2(35),
  20. workphone VARCHAR2(20),
  21. homephone VARCHAR2(20),
  22. startdate DATE DEFAULT SYSDATE,
  23. enddate DATE,
  24. notes VARCHAR2(4000)
  25. );
  26. --
  27. CREATE OR REPLACE TRIGGER employeeid BEFORE INSERT ON employee FOR EACH ROW
  28. BEGIN
  29. SELECT id.nextval
  30. INTO :new.id
  31. FROM DUAL;--
  32. END;;
  33. --
  34. CREATE INDEX employee_id_key ON employee (id);
  35. CREATE UNIQUE INDEX employee_login_key ON employee (login);
  36. CREATE INDEX employee_name_key ON employee (name);
  37. --
  38. ALTER TABLE gl ADD (employee_id INTEGER);
  39. CREATE INDEX gl_employee_id_key ON gl (employee_id);
  40. ALTER TABLE ar ADD (employee_id INTEGER);
  41. CREATE INDEX ar_employee_id_key ON ar (employee_id);
  42. ALTER TABLE ap ADD (employee_id INTEGER);
  43. CREATE INDEX ap_employee_id_key ON ap (employee_id);
  44. ALTER TABLE oe ADD (employee_id INTEGER);
  45. CREATE INDEX oe_employee_id_key ON oe (employee_id);
  46. --
  47. ALTER TABLE invoice ADD (unit VARCHAR2(5));
  48. ALTER TABLE orderitems ADD (unit VARCHAR2(5));
  49. --
  50. UPDATE chart SET gifi_accno = '' WHERE gifi_accno = NULL;
  51. ALTER TABLE chart RENAME TO chartold;
  52. CREATE TABLE chart (
  53. id INTEGER,
  54. accno VARCHAR2(20) NOT NULL,
  55. description VARCHAR2(100),
  56. charttype CHAR(1) DEFAULT 'A',
  57. category CHAR(1),
  58. link VARCHAR2(100),
  59. gifi_accno VARCHAR2(20)
  60. );
  61. INSERT INTO chart (id, accno, description, charttype, category, link, gifi_accno) SELECT id, accno, description, charttype, category, link, gifi_accno from chartold;
  62. DROP TABLE chartold;
  63. CREATE INDEX chart_id_key ON chart (id);
  64. CREATE UNIQUE INDEX chart_accno_key ON chart (accno);
  65. CREATE INDEX chart_category_key ON chart (category);
  66. CREATE INDEX chart_link_key ON chart (link);
  67. CREATE INDEX chart_gifi_accno_key ON chart (gifi_accno);
  68. --
  69. ALTER TABLE parts MODIFY inventory_accno_id;
  70. --
  71. ALTER TABLE defaults ADD (sonumber VARCHAR2(30));
  72. UPDATE defaults SET sonumber = ordnumber;
  73. ALTER TABLE defaults DROP COLUMN ordnumber;
  74. ALTER TABLE defaults ADD (ponumber VARCHAR2(30));
  75. --
  76. UPDATE defaults SET version = '1.8.5';
  77. --