icingadb/schema/pgsql/upgrades/1.2.1.sql

20 lines
983 B
MySQL
Raw Permalink Normal View History

ALTER TABLE host ALTER COLUMN icon_image_alt TYPE text;
ALTER TABLE service ALTER COLUMN icon_image_alt TYPE text;
COMMENT ON COLUMN endpoint.properties_checksum IS 'sha1(all properties)';
COMMENT ON COLUMN comment.properties_checksum IS 'sha1(all properties)';
COMMENT ON COLUMN notification.properties_checksum IS 'sha1(all properties)';
ALTER TABLE timeperiod_range ALTER COLUMN range_value TYPE text;
schema: Enlarge Command Argument and Environment Key From the beginning, the Icinga DB schema allowed 64 characters for both the command arguments and environment variable names[0]. In particular, this affects CheckCommand, EventCommand and NotificationCommand Icinga 2 objects. But if a command with either an argument key or an environment variable that is longer than 64 characters was defined in Icinga 2, Icinga DB will try to insert it into the database and may end up crashing. Although it may seem large enough, it is sometimes exceeded. After evaluating that there was no technical limitation[1], the limit was increased to 255 characters. This limit was chosen over the wider text type as it allows indexes in the future and requires less space. For example, the following CheckCommand was not possible before: > object CheckCommand "icingadb-i791" { > import "plugin-check-command" > command = [ "/bin/true" ] > env = { > "THAT_ARE_64_AS_WOW_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" = "huhu" > } > arguments = { > "java.class.that.was.used.as.an.argument.that.was.eighty.seven.characters.long.and.broke" = { > value = "F" > } > } > } Another thing was a type difference between the MySQL and PostgreSQL schemas. While the MySQL schema defined argument_key_override as varchar(64), in PostgreSQL it was a citext. So it was changed to varchar(255) in MySQL and kept as it was in PostgreSQL. Closes #791. [0]: https://github.com/Icinga/icingadb/commit/05d5e97dd5b73d0792e3416fd66b9257b752fd0c [1]: https://github.com/Icinga/icingadb/issues/791#issuecomment-2291326687
2024-08-15 12:22:33 -04:00
ALTER TABLE checkcommand_argument ALTER COLUMN argument_key TYPE varchar(255);
ALTER TABLE eventcommand_argument ALTER COLUMN argument_key TYPE varchar(255);
ALTER TABLE notificationcommand_argument ALTER COLUMN argument_key TYPE varchar(255);
ALTER TABLE checkcommand_envvar ALTER COLUMN envvar_key TYPE varchar(255);
ALTER TABLE eventcommand_envvar ALTER COLUMN envvar_key TYPE varchar(255);
ALTER TABLE notificationcommand_envvar ALTER COLUMN envvar_key TYPE varchar(255);
INSERT INTO icingadb_schema (version, timestamp)
VALUES (4, extract(epoch from now()) * 1000);