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

Knex wrongly assumes that comments should have less than 60 characters on MySQL Dialect. #4863

Closed
rubenferreira97 opened this issue Nov 30, 2021 · 1 comment · Fixed by #4867

Comments

@rubenferreira97
Copy link

rubenferreira97 commented Nov 30, 2021

Environment

Knex version: 0.95.14
Database + version: 10.4.22-MariaDB
OS: Windows

Bug

  1. Explain what kind of behaviour you are getting and how you think it should do

When running a migration that have a column/table comment with more than 60 characters the following message appears:
"The max length for a table comment is 60 characters"
This message shows multiple times since we have some columns with long comments. It shouldn't trigger any warning since mysql and mariaDB maximum length is 1024 characters (a long time ago was 60).

MySQL Documentation

COMMENT

A comment for a column can be specified with the COMMENT option, up to 1024 characters long. The comment is displayed by the SHOW CREATE TABLE and SHOW FULL COLUMNS statements.

MariaDB Documentation
https://mariadb.com/kb/en/create-table/#comment-column-option

COMMENT Column Option
You can provide a comment for each column using the COMMENT clause. The maximum length is 1024 characters. Use the SHOW FULL COLUMNS statement to see column comments.

This warning appears because of the following code:

if (comment.length > 60)
this.client.logger.warn(
'The max length for a table comment is 60 characters'
);

  1. Error message
    No error message, only a warning every time that a comment with >60 characters appear.
    "The max length for a table comment is 60 characters"

  2. Reduced test code

  return knex.schema
    .createTable('table', (table) => {
      table.comment('A big comment. If we write more than 60 characters here it shouldn't trigger any warning since mysql and mariaDB maximum length is 1024 characters. Please fix this warning, it's annoying when a migration is taking place with multiple long comments.');
    })
@kibertoad
Copy link
Collaborator

Released in 1.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants