-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Schema: merge 1.2.0.sql upgrades into 1.1.1.sql
Initially, we planed a 1.2.0 release instead of 1.1.1 so over time, both schema upgrade files appeared. Merge them to clean up in preparation for the 1.1.1 release. Changes were generated using these commands: { echo; cat schema/mysql/upgrades/1.2.0.sql } >> schema/mysql/upgrades/1.1.1.sql { echo; cat schema/pgsql/upgrades/1.2.0.sql } >> schema/pgsql/upgrades/1.1.1.sql git rm schema/mysql/upgrades/1.2.0.sql git rm schema/pgsql/upgrades/1.2.0.sql
- Loading branch information
1 parent
1ecea76
commit 7a2ab2d
Showing
4 changed files
with
56 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,34 @@ | ||
ALTER TABLE notification | ||
MODIFY COLUMN name varchar(767) NOT NULL COMMENT '255+1+255+1+255, i.e. "host.name!service.name!notification.name"', | ||
MODIFY COLUMN name_ci varchar(767) COLLATE utf8mb4_unicode_ci NOT NULL; | ||
|
||
ALTER TABLE customvar_flat MODIFY COLUMN flatvalue text DEFAULT NULL; | ||
|
||
ALTER TABLE customvar_flat | ||
ADD INDEX idx_customvar_flat_flatname_flatvalue (flatname, flatvalue(255)) COMMENT 'Lists filtered by custom variable'; | ||
|
||
ALTER TABLE hostgroup | ||
ADD INDEX idx_hostgroup_display_name (display_name) COMMENT 'Hostgroup list filtered/ordered by display_name', | ||
ADD INDEX idx_hostgroup_name_ci (name_ci) COMMENT 'Hostgroup list filtered using quick search', | ||
DROP INDEX idx_hostgroup_name, | ||
ADD INDEX idx_hostgroup_name (name) COMMENT 'Host/service/host group list filtered by host group name; Hostgroup detail filter'; | ||
|
||
ALTER TABLE servicegroup | ||
ADD INDEX idx_servicegroup_display_name (display_name) COMMENT 'Servicegroup list filtered/ordered by display_name', | ||
ADD INDEX idx_servicegroup_name_ci (name_ci) COMMENT 'Servicegroup list filtered using quick search', | ||
DROP INDEX idx_servicegroup_name, | ||
ADD INDEX idx_servicegroup_name (name) COMMENT 'Host/service/service group list filtered by service group name; Servicegroup detail filter'; | ||
|
||
-- The following sequence of statements changes the type of history.event_type like the following statement would: | ||
-- | ||
-- ALTER TABLE history MODIFY event_type enum('state_change', 'ack_clear', 'downtime_end', 'flapping_end', 'comment_remove', 'comment_add', 'flapping_start', 'downtime_start', 'ack_set', 'notification') NOT NULL; | ||
-- | ||
-- It's just much faster to add a second column, copy the column using an UPDATE statement and then replace the | ||
-- old column with the one just generated. Table locking ensures that no other connection inserts data in the meantime. | ||
LOCK TABLES history WRITE; | ||
ALTER TABLE history ADD COLUMN event_type_new enum('state_change', 'ack_clear', 'downtime_end', 'flapping_end', 'comment_remove', 'comment_add', 'flapping_start', 'downtime_start', 'ack_set', 'notification') NOT NULL AFTER event_type; | ||
UPDATE history SET event_type_new = event_type; | ||
ALTER TABLE history | ||
DROP COLUMN event_type, | ||
CHANGE COLUMN event_type_new event_type enum('state_change', 'ack_clear', 'downtime_end', 'flapping_end', 'comment_remove', 'comment_add', 'flapping_start', 'downtime_start', 'ack_set', 'notification') NOT NULL; | ||
UNLOCK TABLES; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,27 @@ | ||
ALTER TABLE notification ALTER COLUMN name TYPE varchar(767); | ||
COMMENT ON COLUMN notification.name IS '255+1+255+1+255, i.e. "host.name!service.name!notification.name"'; | ||
|
||
ALTER TABLE customvar_flat ALTER COLUMN flatvalue DROP NOT NULL; | ||
|
||
CREATE INDEX idx_customvar_flat_flatname_flatvalue ON customvar_flat(flatname, flatvalue); | ||
COMMENT ON INDEX idx_customvar_flat_flatname_flatvalue IS 'Lists filtered by custom variable'; | ||
|
||
CREATE INDEX idx_hostgroup_display_name ON hostgroup(display_name); | ||
CREATE INDEX idx_hostgroup_name_ci ON hostgroup(name_ci); | ||
COMMENT ON INDEX idx_hostgroup_display_name IS 'Hostgroup list filtered/ordered by display_name'; | ||
COMMENT ON INDEX idx_hostgroup_name_ci IS 'Hostgroup list filtered using quick search'; | ||
COMMENT ON INDEX idx_hostgroup_name IS 'Host/service/host group list filtered by host group name; Hostgroup detail filter'; | ||
|
||
CREATE INDEX idx_servicegroup_display_name ON servicegroup(display_name); | ||
CREATE INDEX idx_servicegroup_name_ci ON servicegroup(name_ci); | ||
COMMENT ON INDEX idx_servicegroup_display_name IS 'Servicegroup list filtered/ordered by display_name'; | ||
COMMENT ON INDEX idx_servicegroup_name_ci IS 'Servicegroup list filtered using quick search'; | ||
COMMENT ON INDEX idx_servicegroup_name IS 'Host/service/service group list filtered by service group name; Servicegroup detail filter'; | ||
|
||
ALTER TYPE history_type RENAME TO history_type_old; | ||
CREATE TYPE history_type AS ENUM ( 'state_change', 'ack_clear', 'downtime_end', 'flapping_end', 'comment_remove', 'comment_add', 'flapping_start', 'downtime_start', 'ack_set', 'notification' ); | ||
ALTER TABLE history | ||
ALTER COLUMN event_type DROP DEFAULT, | ||
ALTER COLUMN event_type TYPE history_type USING event_type::text::history_type, | ||
ALTER COLUMN event_type SET DEFAULT 'state_change'::history_type; | ||
DROP TYPE history_type_old; |
This file was deleted.
Oops, something went wrong.