From 168c425fb6954646c8a859296f7c85173e539c92 Mon Sep 17 00:00:00 2001
From: Gibheer <gibheer+git@zero-knowledge.org>
Date: Fri, 11 Jan 2019 13:04:35 +0100
Subject: add missing table to database schema

The checks_notify table was missing and needs to be added. As this is
still alpha software, there is no need for a migration step yet.
---
 schema/20181116.sql | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

(limited to 'schema/20181116.sql')

diff --git a/schema/20181116.sql b/schema/20181116.sql
index fcf14b8..ed347a5 100644
--- a/schema/20181116.sql
+++ b/schema/20181116.sql
@@ -53,7 +53,8 @@ CREATE TABLE notifications (
     states integer[] not null,
     output text,
     inserted timestamp with time zone DEFAULT now() NOT NULL,
-    sent timestamp with time zone
+    sent timestamp with time zone,
+    check_host text not null
 );
 
 CREATE TABLE active_checks (
@@ -63,10 +64,16 @@ CREATE TABLE active_checks (
     states integer[] DEFAULT ARRAY[0] NOT NULL,
     intval interval NOT NULL,
     enabled boolean NOT NULL,
-    notify boolean NOT NULL,
     notice text
 );
 
+create table checks_notify(
+  check_id bigint not null references checks(id) on delete cascade,
+  notifier_id int not null references notifier(id) on delete cascade,
+  enabled bool not null default true,
+  unique(check_id, notifier_id)
+);
+
 CREATE INDEX ON active_checks(next_time) WHERE enabled;
 CREATE INDEX ON checks(updated, last_refresh nulls first);
 CREATE INDEX ON checks(node_id);
-- 
cgit v1.2.3-70-g09d2

