1const Pug = db.define('pugs', {
2 name: {
3 type: Sequelize.STRING
4 allowNull: false // name MUST have a value
5 },
6 bio: {
7 name: Sequelize.TEXT
8 },
9 age: {
10 type: Sequelize.INTEGER,
11 validate: {
12 min: 0,
13 max: 100
14 // note: many validations need to be defined in the "validate" object
15 // allowNull is so common that it's the exception
16 }
17 },
18 birthday: {
19 type: Sequelize.DATE,
20 defaultValue: Date.now()
21 // if no birthday is specified when we create the row, it defaults to right now!
22 },
23 colors: {
24 type: Sequelize.ENUM('black', 'fawn')
25 },
26 toys: {
27 type: Sequelize.ARRAY(Sequelize.TEXT)
28 },
29 adoptedStatus: {
30 type: Sequelize.BOOLEAN
31 }
32})
33
1queryInterface.addColumn('OrderBackups', 'my_column', {
2 type: Sequelize.INTEGER,
3 defaultValue: 0
4})