1 -- Updatescript von Version 1.00 auf 2.00
2 -- H.Lindemann Lx-System GbR
5 -- echo "select version from defaults" | psql -q -t -U postgres lx2003
7 --execute ''CREATE SEQUENCE glid start '' || lv.last_value || ''increment 1 maxvalue 9223372036854775807 minvalue 1 cache 1'';
9 LOCK TABLE gl IN ACCESS EXCLUSIVE MODE;
10 LOCK TABLE ar IN ACCESS EXCLUSIVE MODE;
11 LOCK TABLE ap IN ACCESS EXCLUSIVE MODE;
13 CREATE SEQUENCE glid start 1 increment 1 maxvalue 9223372036854775807 minvalue 1 cache 1;
15 CREATE FUNCTION _glid()
17 AS 'DECLARE lv record;
19 SELECT INTO lv last_value from id;
20 execute ''SELECT pg_catalog.setval(''''glid'''', '' || lv.last_value || '' , true)'';
21 return cast(lv.last_value as text);
25 drop function _glid();
28 ALTER TABLE chart ADD COLUMN taxkey_id integer;
29 ALTER TABLE chart ADD COLUMN pos_ustva integer;
30 ALTER TABLE chart ADD COLUMN pos_bwa integer;
31 ALTER TABLE chart ADD COLUMN pos_bilanz integer;
32 ALTER TABLE chart ADD COLUMN pos_eur integer;
35 ALTER TABLE acc_trans ADD COLUMN taxkey integer;
36 ALTER TABLE acc_trans ADD COLUMN gldate date;
37 ALTER TABLE acc_trans ALTER COLUMN gldate SET DEFAULT date('now'::text);
40 ALTER TABLE tax ADD COLUMN taxkey integer;
41 ALTER TABLE tax ADD COLUMN taxdescription text;
44 ALTER TABLE gl ALTER COLUMN id SET DEFAULT nextval('glid'::text);
45 ALTER TABLE gl ADD COLUMN gldate date;
46 ALTER TABLE gl ALTER COLUMN gldate SET DEFAULT date('now'::text);
47 ALTER TABLE gl ADD COLUMN taxinxluded boolean;
50 ALTER TABLE ar ALTER COLUMN id SET DEFAULT nextval('glid'::text);
51 ALTER TABLE ar ADD COLUMN gldate date;
52 ALTER TABLE ar ALTER COLUMN gldate SET DEFAULT date('now'::text);
55 ALTER TABLE ap ALTER COLUMN id SET DEFAULT nextval('glid'::text);
56 ALTER TABLE ap ADD COLUMN gldate date;
57 ALTER TABLE ap ALTER COLUMN gldate SET DEFAULT date('now'::text);
61 ALTER TABLE parts ADD COLUMN shop boolean;
62 ALTER TABLE parts ALTER COLUMN shop SET DEFAULT false;
65 CREATE INDEX contact_name_key ON contacts USING btree (cp_name);
67 update defaults set version = '2.0.0';