mirror of
https://github.com/Icinga/icingadb.git
synced 2026-02-18 18:18:00 -05:00
Merge pull request #1059 from Icinga/schema-index-user_notification_history-retention
schema: Index user_notification_history.notification_history_id
This commit is contained in:
commit
02415f3a67
4 changed files with 9 additions and 1 deletions
|
|
@ -1142,7 +1142,9 @@ CREATE TABLE user_notification_history (
|
|||
|
||||
PRIMARY KEY (id),
|
||||
|
||||
CONSTRAINT fk_user_notification_history_notification_history FOREIGN KEY (notification_history_id) REFERENCES notification_history (id) ON DELETE CASCADE
|
||||
CONSTRAINT fk_user_notification_history_notification_history FOREIGN KEY (notification_history_id) REFERENCES notification_history (id) ON DELETE CASCADE,
|
||||
|
||||
INDEX idx_user_notification_history_notification_history_id (notification_history_id) COMMENT 'Speed up ON DELETE CASCADE'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
|
||||
|
||||
CREATE TABLE state_history (
|
||||
|
|
|
|||
1
schema/mysql/upgrades/1.5.2-pr1059.sql
Normal file
1
schema/mysql/upgrades/1.5.2-pr1059.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE user_notification_history ADD INDEX idx_user_notification_history_notification_history_id (notification_history_id) COMMENT 'Speed up ON DELETE CASCADE';
|
||||
|
|
@ -1840,10 +1840,13 @@ ALTER TABLE user_notification_history ALTER COLUMN environment_id SET STORAGE PL
|
|||
ALTER TABLE user_notification_history ALTER COLUMN notification_history_id SET STORAGE PLAIN;
|
||||
ALTER TABLE user_notification_history ALTER COLUMN user_id SET STORAGE PLAIN;
|
||||
|
||||
CREATE INDEX idx_user_notification_history_notification_history_id ON user_notification_history(notification_history_id);
|
||||
|
||||
COMMENT ON COLUMN user_notification_history.id IS 'sha1(notification_history_id + user_id)';
|
||||
COMMENT ON COLUMN user_notification_history.environment_id IS 'environment.id';
|
||||
COMMENT ON COLUMN user_notification_history.notification_history_id IS 'UUID notification_history.id';
|
||||
COMMENT ON COLUMN user_notification_history.user_id IS 'user.id';
|
||||
COMMENT ON INDEX idx_user_notification_history_notification_history_id IS 'Speed up ON DELETE CASCADE';
|
||||
|
||||
CREATE TABLE state_history (
|
||||
id bytea20 NOT NULL,
|
||||
|
|
|
|||
2
schema/pgsql/upgrades/1.5.2-pr1059.sql
Normal file
2
schema/pgsql/upgrades/1.5.2-pr1059.sql
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
CREATE INDEX idx_user_notification_history_notification_history_id ON user_notification_history(notification_history_id);
|
||||
COMMENT ON INDEX idx_user_notification_history_notification_history_id IS 'Speed up ON DELETE CASCADE';
|
||||
Loading…
Reference in a new issue