summaryrefslogtreecommitdiffstats
path: root/schema/pgsql.schema.sql
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:29:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 13:29:16 +0000
commit982c30171dbfe32bf692d188408dfbb9b5821f7e (patch)
tree8a4056adab2a0ed9795678eb05848bcfcaefa886 /schema/pgsql.schema.sql
parentAdding debian version 0.10.0-2. (diff)
downloadicingaweb2-module-reporting-982c30171dbfe32bf692d188408dfbb9b5821f7e.tar.xz
icingaweb2-module-reporting-982c30171dbfe32bf692d188408dfbb9b5821f7e.zip
Merging upstream version 1.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--schema/pgsql.schema.sql (renamed from schema/postgresql.sql)20
1 files changed, 16 insertions, 4 deletions
diff --git a/schema/postgresql.sql b/schema/pgsql.schema.sql
index 329a65f..d20289c 100644
--- a/schema/postgresql.sql
+++ b/schema/pgsql.schema.sql
@@ -1,9 +1,9 @@
+CREATE TYPE boolenum AS ENUM ('n', 'y');
+
CREATE OR REPLACE FUNCTION unix_timestamp(timestamp with time zone DEFAULT NOW()) RETURNS bigint
AS 'SELECT EXTRACT(EPOCH FROM $1)::bigint'
LANGUAGE SQL;
-CREATE TYPE frequency AS ENUM ('minutely', 'hourly', 'daily', 'weekly', 'monthly');
-
CREATE TABLE template (
id serial PRIMARY KEY,
author varchar(255) NOT NULL,
@@ -73,11 +73,23 @@ CREATE TABLE schedule (
id serial PRIMARY KEY,
report_id int NOT NULL,
author varchar(255) NOT NULL,
- start bigint NOT NULL,
- frequency frequency,
action varchar(255) NOT NULL,
config text DEFAULT NULL,
ctime bigint NOT NULL DEFAULT unix_timestamp() * 1000,
mtime bigint NOT NULL DEFAULT unix_timestamp() * 1000,
CONSTRAINT schedule_report FOREIGN KEY (report_id) REFERENCES report (id) ON DELETE CASCADE ON UPDATE CASCADE
);
+
+CREATE TABLE reporting_schema (
+ id serial,
+ version varchar(64) NOT NULL,
+ timestamp bigint NOT NULL,
+ success boolenum DEFAULT NULL,
+ reason text DEFAULT NULL,
+
+ CONSTRAINT pk_reporting_schema PRIMARY KEY (id),
+ CONSTRAINT idx_reporting_schema_version UNIQUE (version)
+);
+
+INSERT INTO reporting_schema (version, timestamp, success)
+ VALUES ('1.0.0', UNIX_TIMESTAMP() * 1000, 'y');