From 8ca6cc32b2c789a3149861159ad258f2cb9491e3 Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel.baumann@progress-linux.org>
Date: Sun, 28 Apr 2024 14:39:39 +0200
Subject: Adding upstream version 2.11.4.

Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
---
 schema/pgsql-upgrades/2.0.0beta3-2.0.0rc1.sql | 60 +++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 schema/pgsql-upgrades/2.0.0beta3-2.0.0rc1.sql

(limited to 'schema/pgsql-upgrades/2.0.0beta3-2.0.0rc1.sql')

diff --git a/schema/pgsql-upgrades/2.0.0beta3-2.0.0rc1.sql b/schema/pgsql-upgrades/2.0.0beta3-2.0.0rc1.sql
new file mode 100644
index 0000000..7b5b575
--- /dev/null
+++ b/schema/pgsql-upgrades/2.0.0beta3-2.0.0rc1.sql
@@ -0,0 +1,60 @@
+/* Icinga Web 2 | (c) 2014 Icinga Development Team | GPLv2+ */
+
+DROP TABLE "icingaweb_group_membership";
+DROP TABLE "icingaweb_group";
+
+CREATE OR REPLACE FUNCTION unix_timestamp(timestamp with time zone) RETURNS bigint AS '
+        SELECT EXTRACT(EPOCH FROM $1)::bigint AS result
+' LANGUAGE sql;
+
+CREATE TABLE "icingaweb_group" (
+  "id"     serial,
+  "name"   character varying(64) NOT NULL,
+  "parent" int NULL DEFAULT NULL,
+  "ctime"  timestamp NULL DEFAULT NULL,
+  "mtime"  timestamp NULL DEFAULT NULL
+);
+
+ALTER TABLE ONLY "icingaweb_group"
+  ADD CONSTRAINT pk_icingaweb_group
+  PRIMARY KEY (
+    "id"
+);
+
+CREATE UNIQUE INDEX idx_icingaweb_group
+  ON "icingaweb_group"
+  USING btree (
+    lower((name)::text)
+);
+
+ALTER TABLE ONLY "icingaweb_group"
+  ADD CONSTRAINT fk_icingaweb_group_parent_id
+  FOREIGN KEY (
+    "parent"
+  )
+  REFERENCES "icingaweb_group" (
+    "id"
+);
+
+CREATE TABLE "icingaweb_group_membership" (
+  "group_id"   int NOT NULL,
+  "username"   character varying(64) NOT NULL,
+  "ctime"      timestamp NULL DEFAULT NULL,
+  "mtime"      timestamp NULL DEFAULT NULL
+);
+
+ALTER TABLE ONLY "icingaweb_group_membership"
+  ADD CONSTRAINT pk_icingaweb_group_membership
+  FOREIGN KEY (
+    "group_id"
+  )
+  REFERENCES "icingaweb_group" (
+    "id"
+);
+
+CREATE UNIQUE INDEX idx_icingaweb_group_membership
+  ON "icingaweb_group_membership"
+  USING btree (
+    group_id,
+    lower((username)::text)
+);
-- 
cgit v1.2.3

