aboutsummaryrefslogtreecommitdiff
path: root/schema/20181210.sql
diff options
context:
space:
mode:
Diffstat (limited to 'schema/20181210.sql')
-rw-r--r--schema/20181210.sql16
1 files changed, 11 insertions, 5 deletions
diff --git a/schema/20181210.sql b/schema/20181210.sql
index e6be91d..c807863 100644
--- a/schema/20181210.sql
+++ b/schema/20181210.sql
@@ -15,7 +15,8 @@ create table public.mapping_level(
CREATE TABLE public.notifier (
id serial NOT NULL primary key,
- name text NOT NULL
+ name text NOT NULL,
+ settings jsonb not null '{}'::jsonb,
);
CREATE TABLE public.groups (
@@ -57,8 +58,6 @@ CREATE TABLE public.checks (
updated timestamp with time zone DEFAULT now() NOT NULL,
last_refresh timestamp with time zone,
enabled boolean DEFAULT true NOT NULL,
- notifier_id integer NOT NULL,
- notify boolean DEFAULT true NOT NULL,
message text NOT NULL,
unique(node_id, command_id, options)
);
@@ -71,20 +70,27 @@ CREATE TABLE public.active_checks (
states integer[] DEFAULT ARRAY[0] NOT NULL,
intval interval NOT NULL,
enabled boolean NOT NULL,
- notify boolean NOT NULL,
notice text,
msg text NOT NULL,
acknowledged boolean DEFAULT false NOT NULL
);
+create table checks_notify(
+ check_id bigint not null references checks(id),
+ notifier_id bigint not null references notifier(id),
+ enabled bool not null default true,
+ unique(check_id, notifier_id)
+);
+
CREATE TABLE public.notifications (
id bigserial NOT NULL primary key,
check_id bigint NOT NULL references checks(id) on delete cascade,
+ mapping_id integer not null references mappings(id),
+ notifier_id integer not null references notifier(id),
states integer[] NOT NULL,
output text,
inserted timestamp with time zone DEFAULT now() NOT NULL,
sent timestamp with time zone,
- mapping_id integer not null references mappings(id),
);