"Fossies" - the Fresh Open Source Software Archive 
Member "icingaweb2-2.11.4/schema/pgsql-upgrades/2.0.0beta3-2.0.0rc1.sql" (26 Jan 2023, 1407 Bytes) of package /linux/www/icingaweb2-2.11.4.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PL/SQL source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 /* Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */
2
3 DROP TABLE "icingaweb_group_membership";
4 DROP TABLE "icingaweb_group";
5
6 CREATE OR REPLACE FUNCTION unix_timestamp(timestamp with time zone) RETURNS bigint AS '
7 SELECT EXTRACT(EPOCH FROM $1)::bigint AS result
8 ' LANGUAGE sql;
9
10 CREATE TABLE "icingaweb_group" (
11 "id" serial,
12 "name" character varying(64) NOT NULL,
13 "parent" int NULL DEFAULT NULL,
14 "ctime" timestamp NULL DEFAULT NULL,
15 "mtime" timestamp NULL DEFAULT NULL
16 );
17
18 ALTER TABLE ONLY "icingaweb_group"
19 ADD CONSTRAINT pk_icingaweb_group
20 PRIMARY KEY (
21 "id"
22 );
23
24 CREATE UNIQUE INDEX idx_icingaweb_group
25 ON "icingaweb_group"
26 USING btree (
27 lower((name)::text)
28 );
29
30 ALTER TABLE ONLY "icingaweb_group"
31 ADD CONSTRAINT fk_icingaweb_group_parent_id
32 FOREIGN KEY (
33 "parent"
34 )
35 REFERENCES "icingaweb_group" (
36 "id"
37 );
38
39 CREATE TABLE "icingaweb_group_membership" (
40 "group_id" int NOT NULL,
41 "username" character varying(64) NOT NULL,
42 "ctime" timestamp NULL DEFAULT NULL,
43 "mtime" timestamp NULL DEFAULT NULL
44 );
45
46 ALTER TABLE ONLY "icingaweb_group_membership"
47 ADD CONSTRAINT pk_icingaweb_group_membership
48 FOREIGN KEY (
49 "group_id"
50 )
51 REFERENCES "icingaweb_group" (
52 "id"
53 );
54
55 CREATE UNIQUE INDEX idx_icingaweb_group_membership
56 ON "icingaweb_group_membership"
57 USING btree (
58 group_id,
59 lower((username)::text)
60 );