1

I want to create an Enum in table, but it's very long. var nations = ['AC', 'AZ', 'BD'....]

If put it in sequelize.define() directly, it's ugly. Can I define an array first, then pass into sequelize.define()

1 Answer 1

1

Yes

var nations = ['AC', 'AZ', 'BD'....]

sequelize.define('foo', {
  bar: DataTypes.ENUM(nations)
});
Sign up to request clarification or add additional context in comments.

1 Comment

It's so easy, why I'm silly when I tried last time?! Thx!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.