Skip to content

Commit

Permalink
Merge pull request #792 from Icinga/command-args-envs-len-i791
Browse files Browse the repository at this point in the history
schema: Enlarge Command Argument and Environment Key
  • Loading branch information
yhabteab authored Oct 18, 2024
2 parents 58dd332 + 091388d commit 3484476
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 15 deletions.
18 changes: 9 additions & 9 deletions schema/mysql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -562,14 +562,14 @@ CREATE TABLE checkcommand_argument (
id binary(20) NOT NULL COMMENT 'sha1(environment.id + checkcommand_id + argument_key)',
environment_id binary(20) NOT NULL COMMENT 'env.id',
checkcommand_id binary(20) NOT NULL COMMENT 'checkcommand.id',
argument_key varchar(64) NOT NULL,
argument_key varchar(255) NOT NULL,

properties_checksum binary(20) NOT NULL COMMENT 'sha1(all properties)',

argument_value text DEFAULT NULL,
argument_order smallint DEFAULT NULL,
description text DEFAULT NULL,
argument_key_override varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
argument_key_override varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
repeat_key enum('n', 'y') NOT NULL,
required enum('n', 'y') NOT NULL,
set_if varchar(255) DEFAULT NULL,
Expand All @@ -583,7 +583,7 @@ CREATE TABLE checkcommand_envvar (
id binary(20) NOT NULL COMMENT 'sha1(environment.id + checkcommand_id + envvar_key)',
environment_id binary(20) NOT NULL COMMENT 'env.id',
checkcommand_id binary(20) NOT NULL COMMENT 'checkcommand.id',
envvar_key varchar(64) NOT NULL,
envvar_key varchar(255) NOT NULL,

properties_checksum binary(20) NOT NULL COMMENT 'sha1(all properties)',

Expand Down Expand Up @@ -626,14 +626,14 @@ CREATE TABLE eventcommand_argument (
id binary(20) NOT NULL COMMENT 'sha1(environment.id + eventcommand_id + argument_key)',
environment_id binary(20) NOT NULL COMMENT 'env.id',
eventcommand_id binary(20) NOT NULL COMMENT 'eventcommand.id',
argument_key varchar(64) NOT NULL,
argument_key varchar(255) NOT NULL,

properties_checksum binary(20) NOT NULL COMMENT 'sha1(all properties)',

argument_value text DEFAULT NULL,
argument_order smallint DEFAULT NULL,
description text DEFAULT NULL,
argument_key_override varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
argument_key_override varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
repeat_key enum('n', 'y') NOT NULL,
required enum('n', 'y') NOT NULL,
set_if varchar(255) DEFAULT NULL,
Expand All @@ -647,7 +647,7 @@ CREATE TABLE eventcommand_envvar (
id binary(20) NOT NULL COMMENT 'sha1(environment.id + eventcommand_id + envvar_key)',
environment_id binary(20) NOT NULL COMMENT 'env.id',
eventcommand_id binary(20) NOT NULL COMMENT 'eventcommand.id',
envvar_key varchar(64) NOT NULL,
envvar_key varchar(255) NOT NULL,

properties_checksum binary(20) NOT NULL COMMENT 'sha1(all properties)',

Expand Down Expand Up @@ -688,14 +688,14 @@ CREATE TABLE notificationcommand_argument (
id binary(20) NOT NULL COMMENT 'sha1(environment.id + notificationcommand_id + argument_key)',
environment_id binary(20) NOT NULL COMMENT 'env.id',
notificationcommand_id binary(20) NOT NULL COMMENT 'notificationcommand.id',
argument_key varchar(64) NOT NULL,
argument_key varchar(255) NOT NULL,

properties_checksum binary(20) NOT NULL COMMENT 'sha1(all properties)',

argument_value text DEFAULT NULL,
argument_order smallint DEFAULT NULL,
description text DEFAULT NULL,
argument_key_override varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
argument_key_override varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
repeat_key enum('n', 'y') NOT NULL,
required enum('n', 'y') NOT NULL,
set_if varchar(255) DEFAULT NULL,
Expand All @@ -709,7 +709,7 @@ CREATE TABLE notificationcommand_envvar (
id binary(20) NOT NULL COMMENT 'sha1(environment.id + notificationcommand_id + envvar_key)',
environment_id binary(20) NOT NULL COMMENT 'env.id',
notificationcommand_id binary(20) NOT NULL COMMENT 'notificationcommand.id',
envvar_key varchar(64) NOT NULL,
envvar_key varchar(255) NOT NULL,

properties_checksum binary(20) NOT NULL COMMENT 'sha1(all properties)',

Expand Down
11 changes: 11 additions & 0 deletions schema/mysql/upgrades/1.3.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,16 @@ ALTER TABLE notification MODIFY COLUMN properties_checksum binary(20) NOT NULL C

ALTER TABLE timeperiod_range MODIFY COLUMN range_value text NOT NULL;

ALTER TABLE checkcommand_argument MODIFY COLUMN argument_key varchar(255) NOT NULL;
ALTER TABLE checkcommand_argument MODIFY COLUMN argument_key_override varchar(255) NOT NULL;
ALTER TABLE eventcommand_argument MODIFY COLUMN argument_key varchar(255) NOT NULL;
ALTER TABLE eventcommand_argument MODIFY COLUMN argument_key_override varchar(255) NOT NULL;
ALTER TABLE notificationcommand_argument MODIFY COLUMN argument_key varchar(255) NOT NULL;
ALTER TABLE notificationcommand_argument MODIFY COLUMN argument_key_override varchar(255) NOT NULL;

ALTER TABLE checkcommand_envvar MODIFY COLUMN envvar_key varchar(255) NOT NULL;
ALTER TABLE eventcommand_envvar MODIFY COLUMN envvar_key varchar(255) NOT NULL;
ALTER TABLE notificationcommand_envvar MODIFY COLUMN envvar_key varchar(255) NOT NULL;

INSERT INTO icingadb_schema (version, timestamp)
VALUES (6, UNIX_TIMESTAMP() * 1000);
12 changes: 6 additions & 6 deletions schema/pgsql/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ CREATE TABLE checkcommand_argument (
id bytea20 NOT NULL,
environment_id bytea20 NOT NULL,
checkcommand_id bytea20 NOT NULL,
argument_key varchar(64) NOT NULL,
argument_key varchar(255) NOT NULL,

properties_checksum bytea20 NOT NULL,

Expand Down Expand Up @@ -867,7 +867,7 @@ CREATE TABLE checkcommand_envvar (
id bytea20 NOT NULL,
environment_id bytea20 NOT NULL,
checkcommand_id bytea20 NOT NULL,
envvar_key varchar(64) NOT NULL,
envvar_key varchar(255) NOT NULL,

properties_checksum bytea20 NOT NULL,

Expand Down Expand Up @@ -941,7 +941,7 @@ CREATE TABLE eventcommand_argument (
id bytea20 NOT NULL,
environment_id bytea20 NOT NULL,
eventcommand_id bytea20 NOT NULL,
argument_key varchar(64) NOT NULL,
argument_key varchar(255) NOT NULL,

properties_checksum bytea20 NOT NULL,

Expand Down Expand Up @@ -972,7 +972,7 @@ CREATE TABLE eventcommand_envvar (
id bytea20 NOT NULL,
environment_id bytea20 NOT NULL,
eventcommand_id bytea20 NOT NULL,
envvar_key varchar(64) NOT NULL,
envvar_key varchar(255) NOT NULL,

properties_checksum bytea20 NOT NULL,

Expand Down Expand Up @@ -1045,7 +1045,7 @@ CREATE TABLE notificationcommand_argument (
id bytea20 NOT NULL,
environment_id bytea20 NOT NULL,
notificationcommand_id bytea20 NOT NULL,
argument_key varchar(64) NOT NULL,
argument_key varchar(255) NOT NULL,

properties_checksum bytea20 NOT NULL,

Expand Down Expand Up @@ -1076,7 +1076,7 @@ CREATE TABLE notificationcommand_envvar (
id bytea20 NOT NULL,
environment_id bytea20 NOT NULL,
notificationcommand_id bytea20 NOT NULL,
envvar_key varchar(64) NOT NULL,
envvar_key varchar(255) NOT NULL,

properties_checksum bytea20 NOT NULL,

Expand Down
8 changes: 8 additions & 0 deletions schema/pgsql/upgrades/1.3.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@ COMMENT ON COLUMN notification.properties_checksum IS 'sha1(all properties)';

ALTER TABLE timeperiod_range ALTER COLUMN range_value TYPE text;

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);

0 comments on commit 3484476

Please sign in to comment.