2 -- @description: Tabellenstruktur für Wiedervorlagen und allgemeine Notizen
3 -- @depends: release_2_4_3
4 CREATE SEQUENCE note_id;
6 id integer NOT NULL DEFAULT nextval('note_id'),
9 created_by integer NOT NULL,
12 trans_module varchar(10),
14 itime timestamp DEFAULT now(),
18 FOREIGN KEY (created_by) REFERENCES employee (id)
21 CREATE TRIGGER mtime_notes
22 BEFORE UPDATE ON notes
24 EXECUTE PROCEDURE set_mtime();
26 CREATE SEQUENCE follow_up_id;
27 CREATE TABLE follow_ups (
28 id integer NOT NULL DEFAULT nextval('follow_up_id'),
29 follow_up_date date NOT NULL,
30 created_for_user integer NOT NULL,
31 done boolean DEFAULT FALSE,
32 note_id integer NOT NULL,
33 created_by integer NOT NULL,
35 itime timestamp DEFAULT now(),
39 FOREIGN KEY (created_for_user) REFERENCES employee (id),
40 FOREIGN KEY (created_by) REFERENCES employee (id),
41 FOREIGN KEY (note_id) REFERENCES notes (id)
44 CREATE TRIGGER mtime_follow_ups
45 BEFORE UPDATE ON follow_ups
47 EXECUTE PROCEDURE set_mtime();
49 CREATE SEQUENCE follow_up_link_id;
50 CREATE TABLE follow_up_links (
51 id integer NOT NULL DEFAULT nextval('follow_up_link_id'),
52 follow_up_id integer NOT NULL,
53 trans_id integer NOT NULL,
54 trans_type text NOT NULL,
57 itime timestamp DEFAULT now(),
61 FOREIGN KEY (follow_up_id) REFERENCES follow_ups (id)
64 CREATE TRIGGER mtime_follow_up_links
65 BEFORE UPDATE ON follow_up_links
67 EXECUTE PROCEDURE set_mtime();
69 CREATE TABLE follow_up_access (
71 what integer NOT NULL,
73 FOREIGN KEY (who) REFERENCES employee (id),
74 FOREIGN KEY (what) REFERENCES employee (id)