aboutsummaryrefslogtreecommitdiff
path: root/schema/20181210.sql
diff options
context:
space:
mode:
Diffstat (limited to 'schema/20181210.sql')
-rw-r--r--schema/20181210.sql22
1 files changed, 20 insertions, 2 deletions
diff --git a/schema/20181210.sql b/schema/20181210.sql
index 757055d..05236ca 100644
--- a/schema/20181210.sql
+++ b/schema/20181210.sql
@@ -1,3 +1,18 @@
+create table public.mappings(
+ id serial primary key,
+ name text not null,
+ description text not null
+);
+
+create table public.mapping_level(
+ mapping_id integer not null,
+ source int not null,
+ target int not null,
+ title text not null,
+ color text not null,
+ unique(mapping_id, source)
+);
+
CREATE TABLE public.notifier (
id serial NOT NULL primary key,
name text NOT NULL
@@ -10,10 +25,11 @@ CREATE TABLE public.groups (
CREATE TABLE public.nodes (
id bigserial NOT NULL primary key,
+ mapping_id int references mappings(id),
name text NOT NULL,
updated timestamp with time zone DEFAULT now() NOT NULL,
created timestamp with time zone DEFAULT now() NOT NULL,
- message text NOT NULL
+ message text NOT NULL,
);
CREATE TABLE public.nodes_groups (
@@ -28,13 +44,14 @@ CREATE TABLE public.commands (
command text NOT NULL,
updated timestamp with time zone DEFAULT now() NOT NULL,
created timestamp with time zone DEFAULT now() NOT NULL,
- message text NOT NULL
+ message text NOT NULL,
);
CREATE TABLE public.checks (
id bigserial NOT NULL primary key,
node_id integer not null references nodes(id) on delete cascade,
command_id integer not null references commands(id) on delete restrict,
+ mapping_id int references mappings(id),
intval interval DEFAULT '00:05:00'::interval NOT NULL,
options jsonb DEFAULT '{}'::jsonb NOT NULL,
updated timestamp with time zone DEFAULT now() NOT NULL,
@@ -48,6 +65,7 @@ CREATE TABLE public.checks (
CREATE TABLE public.active_checks (
check_id bigint NOT NULL references checks(id) on delete cascade,
+ mapping_id int not null references mappings(id),
cmdline text[] NOT NULL,
next_time timestamp with time zone DEFAULT now() NOT NULL,
states integer[] DEFAULT ARRAY[0] NOT NULL,