diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:46:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:46:43 +0000 |
commit | 3e02d5aff85babc3ffbfcf52313f2108e313aa23 (patch) | |
tree | b01f3923360c20a6a504aff42d45670c58af3ec5 /schema/pgsql-upgrades | |
parent | Initial commit. (diff) | |
download | icingaweb2-3e02d5aff85babc3ffbfcf52313f2108e313aa23.tar.xz icingaweb2-3e02d5aff85babc3ffbfcf52313f2108e313aa23.zip |
Adding upstream version 2.12.1.upstream/2.12.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'schema/pgsql-upgrades')
-rw-r--r-- | schema/pgsql-upgrades/2.0.0beta3-2.0.0rc1.sql | 60 | ||||
-rw-r--r-- | schema/pgsql-upgrades/2.11.0.sql | 10 | ||||
-rw-r--r-- | schema/pgsql-upgrades/2.12.0.sql | 13 | ||||
-rw-r--r-- | schema/pgsql-upgrades/2.5.0.sql | 5 | ||||
-rw-r--r-- | schema/pgsql-upgrades/2.9.0.sql | 16 | ||||
-rw-r--r-- | schema/pgsql-upgrades/2.9.1.sql | 2 |
6 files changed, 106 insertions, 0 deletions
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) +); diff --git a/schema/pgsql-upgrades/2.11.0.sql b/schema/pgsql-upgrades/2.11.0.sql new file mode 100644 index 0000000..9e57ce7 --- /dev/null +++ b/schema/pgsql-upgrades/2.11.0.sql @@ -0,0 +1,10 @@ +CREATE TABLE "icingaweb_schema" ( + "id" serial, + "version" smallint NOT NULL, + "timestamp" int NOT NULL, + + CONSTRAINT pk_icingaweb_schema PRIMARY KEY ("id") +); + +INSERT INTO icingaweb_schema ("version", "timestamp") + VALUES (6, extract(epoch from now())); diff --git a/schema/pgsql-upgrades/2.12.0.sql b/schema/pgsql-upgrades/2.12.0.sql new file mode 100644 index 0000000..2a5818e --- /dev/null +++ b/schema/pgsql-upgrades/2.12.0.sql @@ -0,0 +1,13 @@ +CREATE TYPE boolenum AS ENUM ('n', 'y'); + +ALTER TABLE icingaweb_schema + ALTER COLUMN timestamp TYPE bigint, + ALTER COLUMN version TYPE varchar(64), + ADD COLUMN success boolenum DEFAULT NULL, + ADD COLUMN reason text DEFAULT NULL, + ADD CONSTRAINT idx_icingaweb_schema_version UNIQUE (version); + +UPDATE icingaweb_schema SET timestamp = timestamp * 1000, success = 'y'; + +INSERT INTO icingaweb_schema (version, timestamp, success, reason) + VALUES('2.12.0', EXTRACT(EPOCH FROM now()) * 1000, 'y', NULL); diff --git a/schema/pgsql-upgrades/2.5.0.sql b/schema/pgsql-upgrades/2.5.0.sql new file mode 100644 index 0000000..8139281 --- /dev/null +++ b/schema/pgsql-upgrades/2.5.0.sql @@ -0,0 +1,5 @@ +/* Icinga Web 2 | (c) 2017 Icinga Development Team | GPLv2+ */ + +ALTER TABLE "icingaweb_group_membership" ALTER COLUMN "username" TYPE character varying(254); +ALTER TABLE "icingaweb_user" ALTER COLUMN "name" TYPE character varying(254); +ALTER TABLE "icingaweb_user_preference" ALTER COLUMN "username" TYPE character varying(254); diff --git a/schema/pgsql-upgrades/2.9.0.sql b/schema/pgsql-upgrades/2.9.0.sql new file mode 100644 index 0000000..c017b91 --- /dev/null +++ b/schema/pgsql-upgrades/2.9.0.sql @@ -0,0 +1,16 @@ +CREATE TABLE "icingaweb_rememberme" ( + "id" serial, + "username" character varying(254) NOT NULL, + "passphrase" character varying(256) NOT NULL, + "random_iv" character varying(24) NOT NULL, + "http_user_agent" text NOT NULL, + "expires_at" timestamp NULL DEFAULT NULL, + "ctime" timestamp NULL DEFAULT NULL, + "mtime" timestamp NULL DEFAULT NULL +); + +ALTER TABLE ONLY "icingaweb_rememberme" + ADD CONSTRAINT pk_icingaweb_rememberme + PRIMARY KEY ( + "id" +); diff --git a/schema/pgsql-upgrades/2.9.1.sql b/schema/pgsql-upgrades/2.9.1.sql new file mode 100644 index 0000000..02c683f --- /dev/null +++ b/schema/pgsql-upgrades/2.9.1.sql @@ -0,0 +1,2 @@ +ALTER TABLE ONLY "icingaweb_rememberme" + ALTER COLUMN random_iv type character varying(32); |