Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema update to version 6 produces error #855

Open
alamp1360 opened this issue Nov 15, 2024 · 1 comment · May be fixed by #856
Open

Schema update to version 6 produces error #855

alamp1360 opened this issue Nov 15, 2024 · 1 comment · May be fixed by #856
Assignees
Labels
area/schema bug Something isn't working
Milestone

Comments

@alamp1360
Copy link

When upgrading icingadb MariaDB/MySQL from version 5 to version 6, three errors occur.
Example:

MariaDB [icingadb]> ALTER TABLE checkcommand_argument MODIFY COLUMN argument_key_override varchar(255) NOT NULL;
ERROR 1265 (01000): Data truncated for column 'argument_key_override' at row 1

The error arises because of the "NOT NULL".

When looking at the schema definition which gets installed for a fresh icingadb, for field "argument_key_override", the corresponding table definition does not state "NOT NULL", but "DEFAULT NULL" which is kind of the opposite:

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(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(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,
  `separator` varchar(255) DEFAULT NULL,
  skip_key enum('n', 'y') NOT NULL,

  PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;

So there is an inconsistency between the upgrade and the "fresh" schema.

The same error occurs with two other statements from the upgrade SQL:

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

Maybe i am misinterpreting something, but i guess this might be a bug...

@yhabteab
Copy link
Member

Oh gosh 🙈, thanks for reporting!

@yhabteab yhabteab added bug Something isn't working area/schema labels Nov 15, 2024
@yhabteab yhabteab added this to the 1.3.0 milestone Nov 15, 2024
@yhabteab yhabteab self-assigned this Nov 15, 2024
@yhabteab yhabteab linked a pull request Nov 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/schema bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants