Skip to content

Instantly share code, notes, and snippets.

@victorsteven
Created April 20, 2019 18:12
Show Gist options
  • Select an option

  • Save victorsteven/f38d25f787af6b0430db118380260e85 to your computer and use it in GitHub Desktop.

Select an option

Save victorsteven/f38d25f787af6b0430db118380260e85 to your computer and use it in GitHub Desktop.
Book Migration file
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Books', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
title: {
type: Sequelize.STRING,
allowNull: false,
},
price: {
type: Sequelize.STRING,
allowNull: false,
},
description: {
type: Sequelize.STRING,
allowNull: false,
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface) => {
return queryInterface.dropTable('Books');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment