Cli: Specify array type with model:create

Created on 16 Jul 2015  路  6Comments  路  Source: sequelize/cli

As far as I can tell, there is no way to assign types to arrays using model:create. The syntax could be pretty simple: sequelize model create --name Model --attributes 'info:array:string'. Currently, this will pass, but just create an attribute that is an Array type. Without a type specified for the array, however, db:migrate fails.

Sorry if there is already a means for doing this: if so, I didn't see it after perusing the codebase.

feature

Most helpful comment

Looks like this issue is still valid so I gave it a try :blush:

All 6 comments

Yeah you are right. There is currently no way of doing this. Want to give it a try?

Looks like this issue is still valid so I gave it a try :blush:

Added by https://github.com/sequelize/cli/pull/589, Thanks @link-alex

So, how can I use this in sequelize cli? I am not able to migrate. There is no documentation I could find after about 3 hours of search.

There is no documentation I could find after about 3 hours of search.

yeah guys the docs for the cli are impossible to find pls fix

For anyone stuck on this, the syntax is like:
npx sequelize-cli model:generate --name Player --attributes favoriteColors:array:string

^docs would be great for this!

Was this page helpful?
0 / 5 - 0 ratings