JSFiddle - React, Tailwind, and code Playground
JavaScript
class Migration {
static get table() {
return 'Group';
}
static async up(queryInterface, Sequelize) {
await queryInterface.createTable(Migration.table, {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER,
},
name: {
allowNull: false,
type: Sequelize.STRING,
},
createdAt: {
allowNull: false,
type: Sequelize.DATE,
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE,
},
deletedAt: {
type: Sequelize.DATE,
},
});
await queryInterface.addIndex(Migration.table, {
fields: ['name'],
});
return null;
}
static async down(queryInterface, Sequelize) {
await queryInterface.dropTable(Migration.table);
return null;
}
}
module.exports = Migration;