Skip to content

Instantly share code, notes, and snippets.

@isaacbatst
Created August 28, 2023 23:28
Show Gist options
  • Save isaacbatst/acb158a3921fcd3843126d7f23ac965b to your computer and use it in GitHub Desktop.
Save isaacbatst/acb158a3921fcd3843126d7f23ac965b to your computer and use it in GitHub Desktop.
'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('courses', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
name: {
type: Sequelize.STRING,
allowNull: false,
},
description: {
type: Sequelize.STRING
},
created_at: {
type: Sequelize.DATE,
defaultValue: Sequelize.fn('now') // created_at DATE DEFAULT NOW()
},
active: {
type: Sequelize.BOOLEAN
},
});
},
async down(queryInterface, Sequelize) {
await queryInterface.dropTable('courses');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment