Volltext-Suche: Hintergrund-Job nachts aktivieren
[kivitendo-erp.git] / sql / Pg-upgrade2 / custom_variables.sql
1 -- @tag: custom_variables
2 -- @description: Benutzerdefinierte Variablen für beliebige Module. Hier nur für Kunden- und Lieferantenstammdaten implementiert.
3 -- @depends: release_2_4_3
4 CREATE SEQUENCE custom_variable_configs_id;
5 CREATE TABLE custom_variable_configs (
6        id integer NOT NULL DEFAULT nextval('custom_variable_configs_id'),
7        name text,
8        description text,
9        type varchar(20),
10        module varchar(20),
11        default_value text,
12        options text,
13        searchable boolean,
14        includeable boolean,
15        included_by_default boolean,
16        sortkey integer,
17
18        itime timestamp DEFAULT now(),
19        mtime timestamp,
20
21        PRIMARY KEY (id)
22 );
23
24 CREATE TRIGGER mtime_custom_variable_configs
25     BEFORE UPDATE ON custom_variable_configs
26     FOR EACH ROW
27     EXECUTE PROCEDURE set_mtime();
28
29 CREATE SEQUENCE custom_variables_id;
30 CREATE TABLE custom_variables (
31        id integer NOT NULL DEFAULT nextval('custom_variables_id'),
32        config_id integer NOT NULL,
33        trans_id integer NOT NULL,
34
35        bool_value boolean,
36        timestamp_value timestamp,
37        text_value text,
38        number_value numeric(25,5),
39
40        itime timestamp DEFAULT now(),
41        mtime timestamp,
42
43        PRIMARY KEY (id),
44        FOREIGN KEY (config_id) REFERENCES custom_variable_configs (id)
45 );
46
47 CREATE TRIGGER mtime_custom_variables
48     BEFORE UPDATE ON custom_variables
49     FOR EACH ROW
50     EXECUTE PROCEDURE set_mtime();
51