Skip to content

Creating an array of enums with default value is failing #17087

Closed as not planned

Description

@UdiBen

Bug Description

I have the following migration:

const vals = ['a', 'b'];
module.exports = {
    up: async (queryInterface, Sequelize) => {
        await queryInterface.createTable('test', {
            field: { type: Sequelize.ARRAY(Sequelize.ENUM(vals)), allowNull: false, defaultValue: [] },
        });
    },
    down: async (queryInterface) => {}
}

Running this migration is failing with the following error:
ERROR: Cannot read properties of undefined (reading 'getTableName')

If I change the Array type to STRING, or remove the defaultValue - the migration passes.

What do you expect to happen?

I expect the table to be created

What is actually happening?

ERROR: Cannot read properties of undefined (reading 'getTableName')

Environment

Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.

Activity

  1. added
    pending-approval
    type: bug
    on Feb 13, 2024
  2. WikiRik commented on Feb 13, 2024

    @WikiRik
    Member

    Duplicate of #11285

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

    pending-approvaltype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions