From aeff090d93142dab0770805527bf943091d85274 Mon Sep 17 00:00:00 2001
From: hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>
Date: Mon, 16 Apr 2001 17:46:03 +0000
Subject: Added PostgreSQL support for PHP frontend.

git-svn-id: svn://svn.zabbix.com/trunk@43 97f52cf1-0a1b-0410-bd0e-c28be96e8082
---
 create/postgresql/schema.sql | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'create/postgresql/schema.sql')

diff --git a/create/postgresql/schema.sql b/create/postgresql/schema.sql
index c75c137a..9b6fd060 100644
--- a/create/postgresql/schema.sql
+++ b/create/postgresql/schema.sql
@@ -64,7 +64,7 @@ CREATE TABLE config (
   smtp_server		varchar(255)	DEFAULT '' NOT NULL,
   smtp_helo		varchar(255)	DEFAULT '' NOT NULL,
   smtp_email		varchar(255)	DEFAULT '' NOT NULL,
-  password_required	bool		DEFAULT '0' NOT NULL
+  password_required	int4		DEFAULT '0' NOT NULL
 );
 
 insert into config (smtp_server,smtp_helo,smtp_email) values ('localhost','localhost','zabbix@localhost');
@@ -148,6 +148,7 @@ CREATE TABLE alerts (
   sendto		varchar(100)	DEFAULT '' NOT NULL,
   subject		varchar(255)	DEFAULT '' NOT NULL,
   message		varchar(255)	DEFAULT '' NOT NULL,
+  PRIMARY KEY (alertid),
   FOREIGN KEY (actionid) REFERENCES actions
 );
 
@@ -163,7 +164,8 @@ CREATE TABLE alarms (
   triggerid		int4		DEFAULT '0' NOT NULL,
   clock			int4		DEFAULT '0' NOT NULL,
   istrue		int4		DEFAULT '0' NOT NULL,
-  PRIMARY KEY (alarmid)
+  PRIMARY KEY (alarmid),
+  FOREIGN KEY (triggerid) REFERENCES triggers
 );
 
 --
@@ -194,7 +196,8 @@ CREATE TABLE history (
   itemid		int4		DEFAULT '0' NOT NULL,
   clock			int4		DEFAULT '0' NOT NULL,
   value			float8		DEFAULT '0.0000' NOT NULL,
-  PRIMARY KEY (itemid,clock)
+  PRIMARY KEY (itemid,clock),
+  FOREIGN KEY (itemid) REFERENCES items
 );
 
 
@@ -208,7 +211,8 @@ CREATE TABLE items_template (
   description		varchar(255)	DEFAULT '' NOT NULL,
   key_			varchar(64)	DEFAULT '' NOT NULL,
   delay			int4		DEFAULT '0' NOT NULL,
-  PRIMARY KEY (itemtemplateid)
+  PRIMARY KEY (itemtemplateid),
+  FOREIGN KEY (platformid) REFERENCES platforms
 );
 
 CREATE UNIQUE INDEX items_template_p_k on items_template (platformid, key_);
-- 
cgit 

