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

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

Closed
UdiBen opened this issue Feb 13, 2024 · 1 comment
Closed

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

UdiBen opened this issue Feb 13, 2024 · 1 comment
Labels
pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet type: bug

Comments

@UdiBen
Copy link

UdiBen commented Feb 13, 2024

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.

@UdiBen UdiBen added pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet type: bug labels Feb 13, 2024
@WikiRik
Copy link
Member

WikiRik commented Feb 13, 2024

Duplicate of #11285

@WikiRik WikiRik marked this as a duplicate of #11285 Feb 13, 2024
@WikiRik WikiRik closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet type: bug
Projects
None yet
Development

No branches or pull requests

2 participants