SQLSchema: PostgreSQL fix wrong foreign key schema
This commit is contained in:
parent
2b2ab87338
commit
c58a0db429
|
@ -13,7 +13,7 @@ CREATE TABLE icinga_host_field (
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
ON UPDATE CASCADE,
|
ON UPDATE CASCADE,
|
||||||
CONSTRAINT icinga_host_field_datatype
|
CONSTRAINT icinga_host_field_datatype
|
||||||
FOREIGN KEY datatype (datatype_id)
|
FOREIGN KEY (datatype_id)
|
||||||
REFERENCES director_datatype (id)
|
REFERENCES director_datatype (id)
|
||||||
ON DELETE RESTRICT
|
ON DELETE RESTRICT
|
||||||
ON UPDATE CASCADE
|
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 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_search_idx ON icinga_host_field (fieldname);
|
||||||
CREATE INDEX host_field_host ON icinga_host_field (host_id);
|
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';
|
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 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_search_idx ON icinga_service_field (fieldname);
|
||||||
CREATE INDEX service_field_service ON icinga_service_field (service_id);
|
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';
|
COMMENT ON COLUMN icinga_service_field.service_id IS 'Makes only sense for templates';
|
||||||
|
|
|
@ -497,7 +497,7 @@ CREATE TABLE icinga_host_field (
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
ON UPDATE CASCADE,
|
ON UPDATE CASCADE,
|
||||||
CONSTRAINT icinga_host_field_datatype
|
CONSTRAINT icinga_host_field_datatype
|
||||||
FOREIGN KEY datatype (datatype_id)
|
FOREIGN KEY (datatype_id)
|
||||||
REFERENCES director_datatype (id)
|
REFERENCES director_datatype (id)
|
||||||
ON DELETE RESTRICT
|
ON DELETE RESTRICT
|
||||||
ON UPDATE CASCADE
|
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 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_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);
|
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';
|
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 DELETE CASCADE
|
||||||
ON UPDATE CASCADE,
|
ON UPDATE CASCADE,
|
||||||
CONSTRAINT icinga_service_field_datatype
|
CONSTRAINT icinga_service_field_datatype
|
||||||
FOREIGN KEY datatype (datatype_id)
|
FOREIGN KEY (datatype_id)
|
||||||
REFERENCES director_datatype (id)
|
REFERENCES director_datatype (id)
|
||||||
ON DELETE RESTRICT
|
ON DELETE RESTRICT
|
||||||
ON UPDATE CASCADE
|
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 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_search_idx ON icinga_service_field (fieldname);
|
||||||
CREATE INDEX service_field_service ON icinga_service_field (service_id);
|
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';
|
COMMENT ON COLUMN icinga_service_field.service_id IS 'Makes only sense for templates';
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue