Skip to content

Instantly share code, notes, and snippets.

View manoellribeiro's full-sized avatar

Manoel Ribeiro manoellribeiro

  • Zig. The Global Funtech
  • Feira de Santana | BA
  • 15:14 (UTC -03:00)
View GitHub Profile
@s1moe2
s1moe2 / 20181118235404-some-migration.js
Last active February 4, 2022 17:34
Sequelize migration add/drop multiple columns (transacting)
// NOTE: MySQL does not support transactional DDL (https://dev.mysql.com/doc/internals/en/transactions-notes-on-ddl-and-normal-transaction.html)
// You should use this with a (cool) DBMS such as PostgreSQL.
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.sequelize.transaction((t) => {
return Promise.all([
queryInterface.addColumn('table_name', 'column_name1', {
type: Sequelize.STRING
}, { transaction: t }),