Created
August 28, 2023 23:28
-
-
Save isaacbatst/acb158a3921fcd3843126d7f23ac965b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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