module.exports = {
up: function(queryInterface, Sequelize) {
- return new BPromise(function(resolve, reject) {
-
- var migration = new Migration(queryInterface);
-
- // START CHAT
- migration.dropTable('user_has_chat_rooms');
- migration.dropTable('chat_enquiries');
- migration.dropTable('chat_messages');
- migration.dropTable('chat_proactive_actions');
- migration.dropTable('chat_dispositions');
- migration.dropTable('chat_applications');
- migration.dropTable('user_has_chat_interactions');
- migration.dropTable('chat_interactions');
- migration.dropTable('team_has_chat_queues');
- migration.dropTable('user_has_chat_queues');
- migration.dropTable('chat_queues');
- migration.dropTable('chat_websites');
- // END CHAT
-
- // START OPENCHANNEL
- migration.dropTable('openchannel_messages');
- migration.dropTable('user_has_openchannel_interactions');
- migration.dropTable('openchannel_interactions');
- // END OPENCHANNEL
-
- migration.addIndex('cm_hopper', ['phone'], 'phone');
-
- migration.addIndex('cm_hopper_final', ['calleridnum'], 'calleridnum');
-
- migration.addColumn('users', 'phoneBarUnconditionalNumber', {
- type: Sequelize.STRING
- });
+ return new BPromise(function(resolve, reject) {
+
+ var migration = new Migration(queryInterface);
+
+ // START CHAT
+ migration.dropTable('user_has_chat_rooms');
+ migration.dropTable('chat_enquiries');
+ migration.dropTable('chat_messages');
+ migration.dropTable('chat_proactive_actions');
+ migration.dropTable('chat_dispositions');
+ migration.dropTable('chat_applications');
+ migration.dropTable('user_has_chat_interactions');
+ migration.dropTable('chat_interactions');
+ migration.dropTable('team_has_chat_queues');
+ migration.dropTable('user_has_chat_queues');
+ migration.dropTable('chat_queues');
+ migration.dropTable('chat_websites');
+ // END CHAT
+
+ // START OPENCHANNEL
+ migration.dropTable('openchannel_messages');
+ migration.dropTable('user_has_openchannel_interactions');
+ migration.dropTable('openchannel_interactions');
+ // END OPENCHANNEL
+
+ migration.addIndex('cm_hopper', ['phone'], 'phone');
+
+ migration.addIndex('cm_hopper_final', ['calleridnum'], 'calleridnum');
+
+ migration.addColumn('users', 'phoneBarUnconditionalNumber', {
+ type: Sequelize.STRING
+ });
- migration.addColumn('users', 'phoneBarNoReplyNumber', {
- type: Sequelize.STRING
- });
+ migration.addColumn('users', 'phoneBarNoReplyNumber', {
+ type: Sequelize.STRING
+ });
- migration.addColumn('users', 'phoneBarBusyNumber', {
- type: Sequelize.STRING
- });
+ migration.addColumn('users', 'phoneBarBusyNumber', {
+ type: Sequelize.STRING
+ });
- migration.addColumn('users', 'phoneBarUnconditional', {
- type: Sequelize.BOOLEAN,
- defaultValue: false
- });
+ migration.addColumn('users', 'phoneBarUnconditional', {
+ type: Sequelize.BOOLEAN,
+ defaultValue: false
+ });
- migration.addColumn('users', 'phoneBarNoReply', {
- type: Sequelize.BOOLEAN,
- defaultValue: false
- });
+ migration.addColumn('users', 'phoneBarNoReply', {
+ type: Sequelize.BOOLEAN,
+ defaultValue: false
+ });
- migration.addColumn('users', 'phoneBarBusy', {
- type: Sequelize.BOOLEAN,
- defaultValue: false
- });
+ migration.addColumn('users', 'phoneBarBusy', {
+ type: Sequelize.BOOLEAN,
+ defaultValue: false
+ });
- migration.addColumn('users', 'phoneBarDnd', {
- type: Sequelize.BOOLEAN,
- defaultValue: true
- });
+ migration.addColumn('users', 'phoneBarDnd', {
+ type: Sequelize.BOOLEAN,
+ defaultValue: true
+ });
- migration.changeColumn('campaigns', 'dialQueueTimeout', {
+ migration.changeColumn('campaigns', 'dialQueueTimeout', {
type: Sequelize.INTEGER(3).UNSIGNED,
defaultValue: 3,
validate: {
- min: 1,
- max: 999
+ min: 1,
+ max: 999
},
comment: 'Queue Timeout Seconds (min:1, max:999)'
- });
+ });
- migration.addColumn('voice_queues', 'dialAMDActive', {
- type: Sequelize.BOOLEAN,
- defaultValue: 0,
- comment: 'Active/Disactive AMD'
- });
+ migration.addColumn('voice_queues', 'dialAMDActive', {
+ type: Sequelize.BOOLEAN,
+ defaultValue: 0,
+ comment: 'Active/Disactive AMD'
+ });
- migration.addColumn('voice_queues', 'dialAMDInitialSilence', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('voice_queues', 'dialAMDInitialSilence', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 2500,
- comment: '#AMD Initial Silence'
- });
+ },
+ defaultValue: 2500,
+ comment: '#AMD Initial Silence'
+ });
- migration.addColumn('voice_queues', 'dialAMDGreeting', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('voice_queues', 'dialAMDGreeting', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 1500,
- comment: '#AMD Greeting'
- });
+ },
+ defaultValue: 1500,
+ comment: '#AMD Greeting'
+ });
- migration.addColumn('voice_queues', 'dialAMDAfterGreetingSilence', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('voice_queues', 'dialAMDAfterGreetingSilence', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 800,
- comment: '#AMD After Greeting Silence'
- });
+ },
+ defaultValue: 800,
+ comment: '#AMD After Greeting Silence'
+ });
- migration.addColumn('voice_queues', 'dialAMDTotalAnalysisTime', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('voice_queues', 'dialAMDTotalAnalysisTime', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 5000,
- comment: '#AMD Total Analysis Time'
- });
+ },
+ defaultValue: 5000,
+ comment: '#AMD Total Analysis Time'
+ });
- migration.addColumn('voice_queues', 'dialAMDMinWordLength', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('voice_queues', 'dialAMDMinWordLength', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 100,
- comment: '#AMD Min Word Length'
- });
+ },
+ defaultValue: 100,
+ comment: '#AMD Min Word Length'
+ });
- migration.addColumn('voice_queues', 'dialAMDBetweenWordsSilence', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('voice_queues', 'dialAMDBetweenWordsSilence', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 50,
- comment: '#AMD Between Words Silence'
- });
+ },
+ defaultValue: 50,
+ comment: '#AMD Between Words Silence'
+ });
- migration.addColumn('voice_queues', 'dialAMDMaximumNumberOfWords', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('voice_queues', 'dialAMDMaximumNumberOfWords', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 3,
- comment: '#AMD Maximum Number Of Words'
- });
+ },
+ defaultValue: 3,
+ comment: '#AMD Maximum Number Of Words'
+ });
- migration.addColumn('voice_queues', 'dialAMDSilenceThreshold', {
- type: Sequelize.INTEGER(5).UNSIGNED,
- validate: {
+ migration.addColumn('voice_queues', 'dialAMDSilenceThreshold', {
+ type: Sequelize.INTEGER(5).UNSIGNED,
+ validate: {
min: 0,
max: 32767
- },
- defaultValue: 256,
- comment: '#AMD Silence Threshold (min:0, max:32767)'
- });
+ },
+ defaultValue: 256,
+ comment: '#AMD Silence Threshold (min:0, max:32767)'
+ });
- migration.addColumn('voice_queues', 'dialAMDMaximumWordLength', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('voice_queues', 'dialAMDMaximumWordLength', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 5000,
- comment: '#AMD Maximum Word Length'
- });
+ },
+ defaultValue: 5000,
+ comment: '#AMD Maximum Word Length'
+ });
- migration.addColumn('campaigns', 'dialAMDActive', {
- type: Sequelize.BOOLEAN,
- defaultValue: 0,
- comment: 'Active/Disactive AMD'
- });
+ migration.addColumn('campaigns', 'dialAMDActive', {
+ type: Sequelize.BOOLEAN,
+ defaultValue: 0,
+ comment: 'Active/Disactive AMD'
+ });
- migration.addColumn('campaigns', 'dialAMDInitialSilence', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('campaigns', 'dialAMDInitialSilence', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 2500,
- comment: '#AMD Initial Silence'
- });
+ },
+ defaultValue: 2500,
+ comment: '#AMD Initial Silence'
+ });
- migration.addColumn('campaigns', 'dialAMDGreeting', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('campaigns', 'dialAMDGreeting', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 1500,
- comment: '#AMD Greeting'
- });
+ },
+ defaultValue: 1500,
+ comment: '#AMD Greeting'
+ });
- migration.addColumn('campaigns', 'dialAMDAfterGreetingSilence', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('campaigns', 'dialAMDAfterGreetingSilence', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 800,
- comment: '#AMD After Greeting Silence'
- });
+ },
+ defaultValue: 800,
+ comment: '#AMD After Greeting Silence'
+ });
- migration.addColumn('campaigns', 'dialAMDTotalAnalysisTime', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('campaigns', 'dialAMDTotalAnalysisTime', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 5000,
- comment: '#AMD Total Analysis Time'
- });
+ },
+ defaultValue: 5000,
+ comment: '#AMD Total Analysis Time'
+ });
- migration.addColumn('campaigns', 'dialAMDMinWordLength', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('campaigns', 'dialAMDMinWordLength', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 100,
- comment: '#AMD Min Word Length'
- });
+ },
+ defaultValue: 100,
+ comment: '#AMD Min Word Length'
+ });
- migration.addColumn('campaigns', 'dialAMDBetweenWordsSilence', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('campaigns', 'dialAMDBetweenWordsSilence', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 50,
- comment: '#AMD Between Words Silence'
- });
+ },
+ defaultValue: 50,
+ comment: '#AMD Between Words Silence'
+ });
- migration.addColumn('campaigns', 'dialAMDMaximumNumberOfWords', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('campaigns', 'dialAMDMaximumNumberOfWords', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 3,
- comment: '#AMD Maximum Number Of Words'
- });
+ },
+ defaultValue: 3,
+ comment: '#AMD Maximum Number Of Words'
+ });
- migration.addColumn('campaigns', 'dialAMDSilenceThreshold', {
- type: Sequelize.INTEGER(5).UNSIGNED,
- validate: {
+ migration.addColumn('campaigns', 'dialAMDSilenceThreshold', {
+ type: Sequelize.INTEGER(5).UNSIGNED,
+ validate: {
min: 0,
max: 32767
- },
- defaultValue: 256,
- comment: '#AMD Silence Threshold (min:0, max:32767)'
- });
+ },
+ defaultValue: 256,
+ comment: '#AMD Silence Threshold (min:0, max:32767)'
+ });
- migration.addColumn('campaigns', 'dialAMDMaximumWordLength', {
- type: Sequelize.INTEGER(9).UNSIGNED,
- validate: {
+ migration.addColumn('campaigns', 'dialAMDMaximumWordLength', {
+ type: Sequelize.INTEGER(9).UNSIGNED,
+ validate: {
min: 0
- },
- defaultValue: 5000,
- comment: '#AMD Maximum Word Length'
- });
+ },
+ defaultValue: 5000,
+ comment: '#AMD Maximum Word Length'
+ });
- migration.query("DELETE FROM `voice_extensions` WHERE exten = 'xcally-motion-dialer';");
+ migration.query("DELETE FROM `voice_extensions` WHERE exten = 'xcally-motion-dialer';");
- migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '1', 'NoOp', '', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
+ migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '1', 'NoOp', '', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
- migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '2', 'set', 'CDR(type)=dialer', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
+ migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '2', 'set', 'CDR(type)=dialer', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
- migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '3', 'set', 'CALLERID(all)=${XMD-CALLERID}', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
+ migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '3', 'set', 'CALLERID(all)=${XMD-CALLERID}', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
- migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '4', 'gotoif', '$[\"${XMD-AMD}\" != \"NONE\" ]?5:9', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
+ migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '4', 'gotoif', '$[\"${XMD-AMD}\" != \"NONE\" ]?5:9', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
- migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '5', 'amd', '${XMD-AMDINITIALSILENCE},${XMD-AMDGREETING},${XMD-AMDAFTERGREETINGSILENCE},${XMD-AMDTOTALANALYSISTIME},${XMD-AMDMINWORDLENGTH},${XMD-AMDBETWEENWORDSSILENCE},${XMD-AMDMAXIMUMNUMBEROFWORDS},${XMD-AMDSILENCETHRESHOLD},${XMD-AMDMAXIMUMWORDLENGTH}', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
+ migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '5', 'amd', '${XMD-AMDINITIALSILENCE},${XMD-AMDGREETING},${XMD-AMDAFTERGREETINGSILENCE},${XMD-AMDTOTALANALYSISTIME},${XMD-AMDMINWORDLENGTH},${XMD-AMDBETWEENWORDSSILENCE},${XMD-AMDMAXIMUMNUMBEROFWORDS},${XMD-AMDSILENCETHRESHOLD},${XMD-AMDMAXIMUMWORDLENGTH}', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
- migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '6', 'gotoif', '$[\"${AMDSTATUS}\" == \"HUMAN\" ]?9:7', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
+ migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '6', 'gotoif', '$[\"${AMDSTATUS}\" == \"HUMAN\" ]?9:7', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
- migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`,`createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '7', 'gotoif', '$[\"${AMDSTATUS}\" == \"NOTSURE\" ]?9:8', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
+ migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`,`createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '7', 'gotoif', '$[\"${AMDSTATUS}\" == \"NOTSURE\" ]?9:8', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
- migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`,`createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '8', 'gotoif', '$[\"${AMDSTATUS}\" == \"MACHINE\" ]?11:9', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
+ migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`,`createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '8', 'gotoif', '$[\"${AMDSTATUS}\" == \"MACHINE\" ]?11:9', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
- migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '9', 'execif', '$[\"${XMD-AGI}\" != \"NONE\" ]?AGI(${XMD-AGI})', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
+ migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '9', 'execif', '$[\"${XMD-AGI}\" != \"NONE\" ]?AGI(${XMD-AGI})', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
- migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '10', 'execif', '$[\"${XMD-QUEUE}\" != \"NONE\" ]?QUEUE(${XMD-QUEUE})', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
+ migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `appdata`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '10', 'execif', '$[\"${XMD-QUEUE}\" != \"NONE\" ]?QUEUE(${XMD-QUEUE})', 'system', 'Dialer extensions auto generated', NOW(), NOW());");
- migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '11', 'hangup', 'system', 'dialer extensions auto generated', NOW(), NOW());");
+ migration.query("INSERT INTO `voice_extensions` (`context`, `exten`, `priority`, `app`, `type`, `description`, `createdAt`, `updatedAt`) VALUES ('from-sip', 'xcally-motion-dialer', '11', 'hangup', 'system', 'dialer extensions auto generated', NOW(), NOW());");
- // START FINAL
- migration.final(resolve);
- // END FINAL
+ // START FINAL
+ migration.final(resolve);
+ // END FINAL
});
},
down: function(queryInterface, Sequelize) {
var migration = new Migration(queryInterface);
}
-};
+};
\ No newline at end of file