SQLSchema: PostgreSQL fix wrong foreign key schema

This commit is contained in:
Alexander Fuhr 2015-07-02 14:16:15 +02:00
parent 2b2ab87338
commit c58a0db429
2 changed files with 8 additions and 3 deletions

View File

@ -13,7 +13,7 @@ CREATE TABLE icinga_host_field (
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_host_field_datatype
FOREIGN KEY datatype (datatype_id)
FOREIGN KEY (datatype_id)
REFERENCES director_datatype (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
@ -22,6 +22,8 @@ CREATE TABLE icinga_host_field (
CREATE UNIQUE INDEX host_field_key ON icinga_host_field (host_id, fieldname);
CREATE INDEX host_field_search_idx ON icinga_host_field (fieldname);
CREATE INDEX host_field_host ON icinga_host_field (host_id);
CREATE INDEX host_field_datatype ON icinga_host_field (datatype);
COMMENT ON COLUMN icinga_host_field.host_id IS 'Makes only sense for templates';
@ -49,4 +51,5 @@ CREATE TABLE icinga_service_field (
CREATE UNIQUE INDEX service_field_key ON icinga_service_field (service_id, fieldname);
CREATE INDEX service_field_search_idx ON icinga_service_field (fieldname);
CREATE INDEX service_field_service ON icinga_service_field (service_id);
CREATE INDEX service_field_datatype ON icinga_service_field (datatype);
COMMENT ON COLUMN icinga_service_field.service_id IS 'Makes only sense for templates';

View File

@ -497,7 +497,7 @@ CREATE TABLE icinga_host_field (
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_host_field_datatype
FOREIGN KEY datatype (datatype_id)
FOREIGN KEY (datatype_id)
REFERENCES director_datatype (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
@ -505,6 +505,7 @@ CREATE TABLE icinga_host_field (
CREATE UNIQUE INDEX host_field_key ON icinga_host_field (host_id, fieldname);
CREATE INDEX host_field_search_idx ON icinga_host_field (fieldname);
CREATE INDEX host_field_datatype ON icinga_host_field (datatype);
CREATE INDEX host_field_host ON icinga_host_field (host_id);
COMMENT ON COLUMN icinga_host_field.host_id IS 'Makes only sense for templates';
@ -625,7 +626,7 @@ CREATE TABLE icinga_service_field (
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT icinga_service_field_datatype
FOREIGN KEY datatype (datatype_id)
FOREIGN KEY (datatype_id)
REFERENCES director_datatype (id)
ON DELETE RESTRICT
ON UPDATE CASCADE
@ -634,6 +635,7 @@ CREATE TABLE icinga_service_field (
CREATE UNIQUE INDEX service_field_key ON icinga_service_field (service_id, fieldname);
CREATE INDEX service_field_search_idx ON icinga_service_field (fieldname);
CREATE INDEX service_field_service ON icinga_service_field (service_id);
CREATE INDEX service_field_datatype ON icinga_service_field (datatype);
COMMENT ON COLUMN icinga_service_field.service_id IS 'Makes only sense for templates';