Skip to content

Instantly share code, notes, and snippets.

@mariano-aguero
Last active June 30, 2016 17:41
Show Gist options
  • Save mariano-aguero/43295f51271279678d8448d0fbb52a69 to your computer and use it in GitHub Desktop.
Save mariano-aguero/43295f51271279678d8448d0fbb52a69 to your computer and use it in GitHub Desktop.
Sequelize Migration
'use strict';
var fs = require('fs');
module.exports = {
up: function (queryInterface, Sequelize, done) {
return fs.readFile('./node_modules/pg-job-queue/lib/schema.sql', 'utf-8', function (err, data) {
return queryInterface.sequelize.query(data)
.then(function (response) {
done();
}).catch(function (err) {
done();
});
});
},
down: function (queryInterface, Sequelize, done) {
/*
Add reverting commands here.
Return a promise to correctly handle asynchronicity.
Example:
return queryInterface.dropTable('users');
*/
return queryInterface.dropTable('JobQueue');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment