Skip to content

Instantly share code, notes, and snippets.

@unicodeveloper
Created August 18, 2017 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unicodeveloper/e73243084ecbc74189abf43d9a8ac7c2 to your computer and use it in GitHub Desktop.
Save unicodeveloper/e73243084ecbc74189abf43d9a8ac7c2 to your computer and use it in GitHub Desktop.
// Define our notes table migration
module.exports = {
 up: (queryInterface, Sequelize) => {
 return queryInterface.createTable(‘notes’, {
 id: {
 type: Sequelize.INTEGER,
 primaryKey: true,
 autoIncrement: true,
 },
 title: {
 type: Sequelize.TEXT,
 },
 body: {
 type: Sequelize.TEXT,
 },
 userId: {
 type: Sequelize.INTEGER,
 references: {
 model: ‘users’,
 key: ‘id’,
 },
 },
 createdAt: {
 type: Sequelize.DATE,
 },
 updatedAt: {
 type: Sequelize.DATE,
 },
 });
 },
 down: (queryInterface) => {
 return queryInterface.dropTable(‘notes’);
 },
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment