var logger = require('../config/logger')('migration');
var Migration = function(queryInterface) {
- this.queryInterface = queryInterface;
+ this.queryInterface = queryInterface;
};
Migration.prototype.addColumn = function(table, column, type) {
- return this.queryInterface
- .addColumn(table, column, type)
- .then(function(res) {
- logger.info('Added column %s to %s', column, table);
- })
- .catch(function(err) {
- logger.info(JSON.stringify(err));
- });
+ return this.queryInterface
+ .addColumn(table, column, type)
+ .then(function(res) {
+ logger.info('Added column %s to %s', column, table);
+ })
+ .catch(function(err) {
+ logger.info(JSON.stringify(err));
+ });
};
Migration.prototype.removeColumn = function(table, column) {
- return this.queryInterface
- .removeColumn(table, column)
- .then(function(res) {
- logger.info('Removed column %s from %s', column, table);
- })
- .catch(function(err) {
- logger.info(JSON.stringify(err));
- });
+ return this.queryInterface
+ .removeColumn(table, column)
+ .then(function(res) {
+ logger.info('Removed column %s from %s', column, table);
+ })
+ .catch(function(err) {
+ logger.info(JSON.stringify(err));
+ });
};
Migration.prototype.renameColumn = function(table, oldColumn, newColumn) {
- return this.queryInterface
- .renameColumn(table, oldColumn, newColumn)
- .then(function(res) {
- logger.info('Renamed column from %s to %s on %s', oldColumn, newColumn, table);
- })
- .catch(function(err) {
- logger.info(JSON.stringify(err));
- });
+ return this.queryInterface
+ .renameColumn(table, oldColumn, newColumn)
+ .then(function(res) {
+ logger.info('Renamed column from %s to %s on %s', oldColumn, newColumn, table);
+ })
+ .catch(function(err) {
+ logger.info(JSON.stringify(err));
+ });
};
Migration.prototype.dropTable = function(table) {
- return this.queryInterface
- .dropTable(table)
- .then(function(res) {
- logger.info('table dropped %s', table);
- })
- .catch(function(err) {
- logger.info(JSON.stringify(err));
- });
+ return this.queryInterface
+ .dropTable(table)
+ .then(function(res) {
+ logger.info('table dropped %s', table);
+ })
+ .catch(function(err) {
+ logger.info(JSON.stringify(err));
+ });
};
module.exports = {
- up: function(queryInterface, Sequelize) {
- var migration = new Migration(queryInterface);
+ up: function(queryInterface, Sequelize) {
+ var migration = new Migration(queryInterface);
- migration.dropTable('jscripty_projects', {
- force: true
- });
+ migration.dropTable('jscripty_projects', {
+ force: true
+ });
- migration.dropTable('report_jscripty_inputs', {
- force: true
- });
+ migration.dropTable('report_jscripty_inputs', {
+ force: true
+ });
- migration.dropTable('report_jscripty_questions', {
- force: true
- });
+ migration.dropTable('report_jscripty_questions', {
+ force: true
+ });
- migration.dropTable('report_jscripty_sessions', {
- force: true
- });
- },
+ migration.dropTable('report_jscripty_sessions', {
+ force: true
+ });
+ },
- down: function(queryInterface, Sequelize) {
+ down: function(queryInterface, Sequelize) {
- }
-};
\ No newline at end of file
+ }
+};