Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

Sequelize model datatype of enum

const Person = sequelize.define('model', {
  name: {
	type: Sequelize.STRING
  },
  gender: {
    type:   Sequelize.ENUM,
    values: ['Male', 'Female', 'Others']
  },
  bloodGroup: {
    type:   Sequelize.ENUM('A', 'B', 'AB', 'O')
  }
});

console.log(Person.rawAttributes.gender.values);
// log output => ['Male', 'Female', 'Others']
console.log(Person.rawAttributes.bloodGroup.values);
// log output => ['A', 'B', 'AB', 'O']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Sequelize #model #datatype #enum
ADD COMMENT
Topic
Name
2+5 =