Skip to content

changeColumn error when updating ENUM value #9874

Closed

Description

@WaleedAshraf

changeColumn: update ENUM value from uppercase to lowercase

up:

return queryInterface.changeColumn(
	'users',
	'v_status',
	{ type: Sequelize.ENUM, values: ['active', 'passive', 'archived', 'deleted'], allowNull: false, validate: { notEmpty: true } }
);


down:

return queryInterface.changeColumn(
	'users',
	'v_status',
	{ type: Sequelize.ENUM, values: ['Active', 'Passive', 'Archived', 'Deleted'], allowNull: false, validate: { notEmpty: true } }
);

What do you expect to happen?

I expted values to change,
from: 'Active', 'Passive', 'Archived', 'Deleted'
to: 'active', 'passive', 'archived', 'deleted'

What is actually happening?

Error:

Executing (default): ALTER TABLE `users` CHANGE `v_status` `v_status` ENUM() NOT NULL;
{ SequelizeDatabaseError: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') NOT NULL' at line 1
    at ...node_modules/sequelize/lib/dialects/mysql/query.js:175:14)

Dialect: mysql
Dialect version: 5.1.44
Sequelize version: Sequelize [Node: 8.9.0, CLI: 2.8.0, ORM: 3.30.4]

Activity

  1. added a commit that references this issue on Sep 4, 2018
    a785dca
  2. sushantdhiman commented on Sep 5, 2018

    @sushantdhiman
    Contributor

    v3 no longer supported

  3. WaleedAshraf commented on Sep 8, 2018

    @WaleedAshraf
    Author

    @sushantdhiman this is also present in latest version. You closed it too early.

  4. sushantdhiman commented on Sep 8, 2018

    @sushantdhiman
    Contributor

    We close issues as soon as they land to master branch, fix already released as 5.0.0-beta.12

  5. WaleedAshraf commented on Sep 8, 2018

    @WaleedAshraf
    Author

    @sushantdhiman, that's totally fine.
    But in this case, you closed it before the fix.

  6. sushantdhiman commented on Sep 8, 2018

    @sushantdhiman
    Contributor

    Because you only tested this with v3 so I wasn;t aware if this issue was affecting upstream. We no longer support v3, so those issue get closed by default

  7. WaleedAshraf commented on Sep 8, 2018

    @WaleedAshraf
    Author

    My fix was against upstream which made it clear.

  8. sushantdhiman commented on Sep 9, 2018

    @sushantdhiman
    Contributor

    I closed this issue before taking a look at PR, I have lots of issues to look after so I first go through issues then to PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions