var util = require('util');
var Migration = function(queryInterface) {
- this.queryInterface = queryInterface;
+ this.queryInterface = queryInterface;
};
Migration.prototype.changeColumn = function(table, column, type) {
- return this.queryInterface
- .changeColumn(table, column, type)
- .then(function(res) {
- logger.info('Changed column %s in table %s', column, table);
- })
- .catch(function(err) {
- logger.info(util.inspect(err, {
- showHidden: false,
- depth: null
- }));
- });
+ return this.queryInterface
+ .changeColumn(table, column, type)
+ .then(function(res) {
+ logger.info('Changed column %s in table %s', column, table);
+ })
+ .catch(function(err) {
+ logger.info(util.inspect(err, {
+ showHidden: false,
+ depth: null
+ }));
+ });
};
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));
+ });
};
module.exports = {
- up: function(queryInterface, Sequelize) {
- var migration = new Migration(queryInterface);
-
- migration.changeColumn('tools_trunks', 'sendrpid', {
- type: Sequelize.ENUM('yes', 'no', 'pai'),
- defaultValue: 'no'
- });
-
- migration.addColumn('mail_servers_out', 'authentication', {
- type: Sequelize.BOOLEAN,
- defaultValue: true
- });
-
- migration.changeColumn('voice_queues', 'timeout', {
- type: Sequelize.INTEGER(11),
- defaultValue: 15
- });
-
- migration.changeColumn('voice_queues', 'retry', {
- type: Sequelize.INTEGER(11),
- defaultValue: 2
- });
-
- migration.changeColumn('users', 'allow', {
- type: Sequelize.STRING,
- allowNull: false,
- defaultValue: 'ulaw;alaw;gsm'
- });
-
- migration.changeColumn('tools_trunks', 'allow', {
- type: Sequelize.STRING,
- allowNull: false,
- defaultValue: 'ulaw;alaw;gsm'
- });
-
- migration.addColumn('voice_queues', 'dialCheckDuplicateType', {
- type: Sequelize.ENUM('always', 'never', 'onlyIfOpen'),
- defaultValue: 'always'
- });
-
- migration.addColumn('campaigns', 'dialCheckDuplicateType', {
- type: Sequelize.ENUM('always', 'never', 'onlyIfOpen'),
- defaultValue: 'always'
- });
-
- migration.addColumn('mail_accounts', 'email', {
- type: Sequelize.STRING
- });
- },
-
- down: function(queryInterface, Sequelize) {
- var migration = new Migration(queryInterface);
- }
-};
\ No newline at end of file
+ up: function(queryInterface, Sequelize) {
+ var migration = new Migration(queryInterface);
+
+ migration.changeColumn('tools_trunks', 'sendrpid', {
+ type: Sequelize.ENUM('yes', 'no', 'pai'),
+ defaultValue: 'no'
+ });
+
+ migration.addColumn('mail_servers_out', 'authentication', {
+ type: Sequelize.BOOLEAN,
+ defaultValue: true
+ });
+
+ migration.changeColumn('voice_queues', 'timeout', {
+ type: Sequelize.INTEGER(11),
+ defaultValue: 15
+ });
+
+ migration.changeColumn('voice_queues', 'retry', {
+ type: Sequelize.INTEGER(11),
+ defaultValue: 2
+ });
+
+ migration.changeColumn('users', 'allow', {
+ type: Sequelize.STRING,
+ allowNull: false,
+ defaultValue: 'ulaw;alaw;gsm'
+ });
+
+ migration.changeColumn('tools_trunks', 'allow', {
+ type: Sequelize.STRING,
+ allowNull: false,
+ defaultValue: 'ulaw;alaw;gsm'
+ });
+
+ migration.addColumn('voice_queues', 'dialCheckDuplicateType', {
+ type: Sequelize.ENUM('always', 'never', 'onlyIfOpen'),
+ defaultValue: 'always'
+ });
+
+ migration.addColumn('campaigns', 'dialCheckDuplicateType', {
+ type: Sequelize.ENUM('always', 'never', 'onlyIfOpen'),
+ defaultValue: 'always'
+ });
+
+ migration.addColumn('mail_accounts', 'email', {
+ type: Sequelize.STRING
+ });
+ },
+
+ down: function(queryInterface, Sequelize) {
+ var migration = new Migration(queryInterface);
+ }
+};