Skip to content

Instantly share code, notes, and snippets.

@theptrk
Created April 13, 2019 04:21
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 theptrk/8e92a45b1ebd49bf7dc44ffa9138e36b to your computer and use it in GitHub Desktop.
Save theptrk/8e92a45b1ebd49bf7dc44ffa9138e36b to your computer and use it in GitHub Desktop.
Run $ /node_modules/.bin/sequelize migration:generate --name 1m_user_to_dids
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn(
'Dids',
'UserId',
{
type: Sequelize.INTEGER,
references: {
model: 'Users',
key: "id"
},
onDelete: 'cascade',
allowNull: false
})
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn('Dids', 'UserId');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment