X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/435a5be586488ee4700b0a4fed0c91b5a5e1abfb..2ceb6719379a2825dfd3f2ea41c94eb7ec06a491:/sql/Pg-upgrade-2.1.1-2.1.2.sql

diff --git a/sql/Pg-upgrade-2.1.1-2.1.2.sql b/sql/Pg-upgrade-2.1.1-2.1.2.sql
index 476e4020b..6cfb12be7 100644
--- a/sql/Pg-upgrade-2.1.1-2.1.2.sql
+++ b/sql/Pg-upgrade-2.1.1-2.1.2.sql
@@ -132,6 +132,8 @@ alter table vendor add column salesman_id integer;
 alter table shipto add column shiptodepartment_1 varchar(75);
 alter table shipto add column shiptodepartment_2 varchar(75);
 
+
+
 -- Addon for business
 alter table business add column salesman boolean;
 alter table business alter column salesman set default 'false';
@@ -170,7 +172,6 @@ alter table acc_trans add foreign key (chart_id) references chart (id);
 alter table invoice add foreign key (parts_id) references parts (id);
 alter table ar add foreign key (customer_id) references customer (id);
 alter table ap add foreign key (vendor_id) references vendor (id);
-alter table orderitems add foreign key (trans_id) references oe (id);
 alter table orderitems add foreign key (parts_id) references parts (id);
 
 --Modify the possible length of bank account numbers
@@ -184,6 +185,39 @@ update vendor set temp_account_number=account_number;
 alter table vendor drop column account_number;
 alter table vendor rename temp_account_number to  account_number;
 
-update defaults set version = '2.1.2';
+-- audit
+alter table defaults add column audittrail bool;
+CREATE TABLE audittrail (
+  trans_id int,
+  tablename text,
+  reference text,
+  formname text,
+  action text,
+  transdate timestamp default current_timestamp,
+  employee_id int
+);
+
+-- pricegroups
+
+CREATE TABLE "pricegroup" (
+  "id" integer DEFAULT nextval('id'::text),
+  "pricegroup" text not null,
+  PRIMARY KEY (id)
+);
+
+CREATE TABLE "prices" (
+  "parts_id" integer REFERENCES parts(id),
+  "pricegroup_id" integer REFERENCES pricegroup(id),
+  "price" numeric(15,5)
+);
+
+ALTER TABLE customer ADD column klass integer;
+ALTER TABLE customer ALTER column klass set default 0;
+
+-- 
+ALTER TABLE invoice ADD column pricegroup_id integer;
+ALTER TABLE orderitems ADD column pricegroup_id integer;
+
+update defaults set version = '2.1.2', audittrail = 't';
 --
 
