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

renameColumn throws an error when renaming enum column type on MySQL #5492

Open
andybee opened this issue Feb 19, 2023 · 0 comments
Open

renameColumn throws an error when renaming enum column type on MySQL #5492

andybee opened this issue Feb 19, 2023 · 0 comments

Comments

@andybee
Copy link

andybee commented Feb 19, 2023

Environment

Knex version: 2.4.2
Database + version: MySQL 5.6.51
OS: Oracle Linux

Bug

When attempting to rename an enum column type in a migration, an error is thrown:

migration failed with error: object is not iterable (cannot read property Symbol(Symbol.iterator))
TypeError: object is not iterable (cannot read property Symbol(Symbol.iterator))
    at ./node_modules/knex/lib/dialects/mysql/schema/mysql-tablecompiler.js:86:48
    at async Runner.ensureConnection (./node_modules/knex/lib/execution/runner.js:300:14)
    at async Runner.run (./node_modules/knex/lib/execution/runner.js:30:19)
    at async Migrator._runBatch (./node_modules/knex/lib/migrations/migrate/Migrator.js:381:19)

Example migrations that replicate the error:

exports.up = (knex) => knex.schema
  .createTable('example', (table) => {
    table.enu('status', ['a', 'b', 'c']).default('a').notNullable();
  });

exports.down = () => {};
exports.up = (knex) => knex.schema
  .alterTable('example', (table) => {
    table.renameColumn('status', 'alternative');
  });

exports.down = () => {};
@andybee andybee changed the title renameColumn throws an error when renaming enu column type on MySQL renameColumn throws an error when renaming enum column type on MySQL Feb 19, 2023
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

No branches or pull requests

1 participant