Skip to content

Instantly share code, notes, and snippets.

@samratshaw
Created July 30, 2018 09:50
Show Gist options
  • Save samratshaw/e673dc65c8d80b50dd96959c2c9797ea to your computer and use it in GitHub Desktop.
Save samratshaw/e673dc65c8d80b50dd96959c2c9797ea to your computer and use it in GitHub Desktop.
Medium: Sequelize Typescript create migration
cat > ./src/db/migrations/$(date +"%Y%m%d%H%M%S")-$1.ts << EOF
import { QueryInterface, SequelizeStatic } from 'sequelize';
module.exports = {
// tslint:disable-next-line:variable-name
up: async (queryInterface: QueryInterface, Sequelize: SequelizeStatic) => {
// Write migration code here.
},
// tslint:disable-next-line:variable-name
down: async (queryInterface: QueryInterface, Sequelize: SequelizeStatic) => {
// If migration fails, this will be called. Rollback your migration changes.
},
};
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment