schema/pgsql: fix primary key on icinga_user_*_set

This commit is contained in:
Thomas Gelf 2016-03-02 20:48:10 +01:00
parent 3d4052fa0c
commit 4dfe03816a
2 changed files with 14 additions and 3 deletions

View File

@ -0,0 +1,11 @@
ALTER TABLE icinga_user_states_set
DROP CONSTRAINT icinga_user_states_set_pkey,
ADD PRIMARY KEY (user_id, property, merge_behaviour);
ALTER TABLE icinga_user_types_set
DROP CONSTRAINT icinga_user_types_set_pkey,
ADD PRIMARY KEY (user_id, property, merge_behaviour);
INSERT INTO director_schema_migration
(schema_version, migration_time)
VALUES (79, NOW());

View File

@ -957,7 +957,7 @@ CREATE TABLE icinga_user_states_set (
user_id integer NOT NULL,
property enum_state_name NOT NULL,
merge_behaviour enum_set_merge_behaviour NOT NULL DEFAULT 'override',
PRIMARY KEY (user_id, property),
PRIMARY KEY (user_id, property, merge_behaviour),
CONSTRAINT icinga_user_filter_state_user
FOREIGN KEY (user_id)
REFERENCES icinga_user (id)
@ -973,7 +973,7 @@ CREATE TABLE icinga_user_types_set (
user_id integer NOT NULL,
property enum_type_name NOT NULL,
merge_behaviour enum_set_merge_behaviour NOT NULL DEFAULT 'override',
PRIMARY KEY (user_id, property),
PRIMARY KEY (user_id, property, merge_behaviour),
CONSTRAINT icinga_user_filter_type_user
FOREIGN KEY (user_id)
REFERENCES icinga_user (id)
@ -1415,4 +1415,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance
-- set current schema version
INSERT INTO director_schema_migration
(schema_version, migration_time)
VALUES (78, NOW());
VALUES (79, NOW());