How do I define Sequelize.STRING length?

gusera2334967 picture gusera2334967 · Apr 30, 2013 · Viewed 32k times · Source

I want to define a length of a datatype in sequelize. There is my source code :

var Profile = sequelize.define('profile', {
  public_id: Sequelize.STRING,
  label: Sequelize.STRING
})

It create a table profiles with a public_id with a datatype varchar(255).

I would like to define a public_id with varchar(32).

I searched on the doc and the stack but couldn't find any answer...

How can I do that please ?

Answer

Szymon Wygnański picture Szymon Wygnański · Oct 13, 2013

As it is mentioned in the documentation, use:

Sequelize.STRING(32)