Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / migrations / 2.1.0.js
1 const a1128_0x11f3=['\x20\x20\x20\x20\x20\x20type\x20varchar(255)\x20not\x20null,','\x20\x20ORDER\x20BY\x20GROUP_CONCAT(id);','\x20\x20\x20\x20\x20\x20insertedSectionId\x20int(11)\x20not\x20null,','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201303\x20THEN\x20\x27FreshdeskAccounts\x27','\x20\x20SELECT\x20x.sectionId,\x20u.SmsAccountId,\x20x.userId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20tally\x20t\x20INNER\x20JOIN\x20tmpPermissions\x20r\x20ON\x20CHAR_LENGTH(r.userIds)\x20-\x20CHAR_LENGTH(REPLACE(r.userIds,\x20\x27,\x27,\x20\x27\x27))\x20>=\x20t.n-1','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20100\x20THEN\x20\x27Dashboards\x27','sequence','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201002\x20THEN\x20\x27Dispositions\x27','\x20\x20\x20\x20userId\x20text,','\x20\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x20501\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20chat_queues\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)','\x20\x20SET\x20u.userProfileId\x20=\x20f.profileId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201601\x20THEN\x20\x27DELETE\x27','\x20\x20WHERE\x20x.sectionId\x20=\x20501;','addIndex\x20%s\x20%s\x20%s','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20CASE','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201006\x20THEN\x20\x27Scheduler\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201201\x20THEN\x20\x27Metrics\x27','\x20\x20\x20\x20insertedId\x20int(11),','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20tmpNormalizedUsers','\x20\x20INNER\x20JOIN\x20user_has_fax_queues\x20u\x20ON\x20u.UserId\x20=\x20x.userId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20304\x20THEN\x20\x27GlobalCustomFields\x27','query','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(601,\x20602,\x20603,\x20610)\x20THEN\x20\x27Mail\x27','../config/logger','\x20\x20\x20\x20userProfileId\x20int(11)\x20not\x20null,','removeColumn','\x20\x20WHERE\x20x.sectionId\x20=\x201103;','\x20\x20\x20\x20userId\x20int(11)\x20not\x20null','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201701\x20THEN\x20\x27jscripty\x27','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpNormalizedUsers;','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpGroupedPermissions;','INSERT\x20INTO\x20tmpNormalizedPermissions','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(401,\x20402,\x20403,\x20404,\x20405,\x20406,\x20407,\x20408,\x20409,\x20410,\x20411)\x20THEN\x20\x27Voice\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201203\x20THEN\x20\x27Reports\x27','\x20\x20WHERE\x20name\x20=\x20\x27DELETE\x27;','\x20\x20\x20\x20resourceId\x20int(11)\x20not\x20null,','\x20\x20INNER\x20JOIN\x20voice_queues\x20q\x20ON\x20u.VoiceQueueId\x20=\x20q.id','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201306\x20THEN\x20\x27DeskAccounts\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20POSITION(\x27,\x27\x20in\x20r.userIds)\x20>\x200','\x20\x20SELECT\x20x.sectionId,\x20u.FaxAccountId,\x20x.userId','CREATE\x20TABLE\x20tmpNormalizedResources','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201000\x20THEN\x20\x27DELETE\x27','\x20\x20WHERE\x20x.sectionId\x20=\x20601;','\x20\x20SELECT\x20\x27\x27,\x20\x27\x27,\x20permission,\x201,\x200,\x20profileId,\x20null,\x20userId','users','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20601\x20THEN\x20\x27MailQueues\x27','\x20\x20PRIMARY\x20KEY\x20(`id`),','\x20\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x20702\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20sms_accounts\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)','\x20\x20WHERE\x20role\x20=\x20\x27user\x27\x20and\x20permissions\x20is\x20not\x20null\x20and\x20permissions\x20<>\x20\x27\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201305\x20THEN\x20\x27SugarcrmAccounts\x27','\x20\x20\x20\x20resourceId\x20text','\x20\x20SELECT\x20userId,\x20permissions,\x20null','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20SUBSTRING_INDEX(SUBSTRING_INDEX(r.userIds,\x20\x27,\x27,\x20t.n),\x20\x27,\x27,\x20-1)\x20userId','\x20\x20\x20\x20\x20\x20SUBSTRING_INDEX(SUBSTRING_INDEX(s.userId,\x20\x27,\x27,\x20t.n),\x20\x27,\x27,\x20-1)\x20userId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20901\x20THEN\x20\x27FaxQueues\x27','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpFinalProfiles;','\x20\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x20401\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20voice_queues\x20WHERE\x20id\x20=\x20x.resourceId\x20AND\x20type\x20=\x20\x27inbound\x27),\x27DELETE_MIGRATION\x27)','\x20\x20resourceId\x20int(11),','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20300\x20THEN\x20\x27DELETE\x27','INSERT\x20INTO\x20tmpExtractedResources','\x20\x20INNER\x20JOIN\x20user_has_voice_queues\x20u\x20ON\x20u.UserId\x20=\x20x.userId','\x20\x20\x20\x20\x20\x20userId\x20text\x20not\x20null,','CREATE\x20TABLE\x20tmpSingleProfiles','\x20\x20WHERE\x20t1.name\x20=\x20t2.name\x20AND\x20t1.userProfileId\x20=\x20t2.userProfileId\x20AND\x20t1.sectionId\x20>\x20t2.sectionId;','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20401\x20THEN\x20\x27VoiceQueues\x27',',(SELECT\x200\x20AS\x20N\x20UNION\x20ALL\x20SELECT\x201\x20UNION\x20ALL\x20SELECT\x202\x20UNION\x20ALL\x20SELECT\x203\x20UNION\x20ALL\x20SELECT\x204\x20UNION\x20ALL\x20SELECT\x205\x20UNION\x20ALL\x20SELECT\x206\x20UNION\x20ALL\x20SELECT\x207\x20UNION\x20ALL\x20SELECT\x208\x20UNION\x20ALL\x20SELECT\x209)\x20c','\x20\x20INNER\x20JOIN\x20user_has_openchannel_accounts\x20u\x20ON\x20u.UserId\x20=\x20x.userId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20502\x20THEN\x20\x27ChatWebsites\x27','\x20\x20`name`\x20varchar(255)\x20NOT\x20NULL,','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20810\x20THEN\x20\x27Realtime\x27','\x20\x20WHERE\x20name\x20in\x20(\x27Plugins\x27,\x20\x27CustomDashboards\x27);','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20204\x20THEN\x20\x27Teams\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20n)\x20as\x20split','CREATE\x20TABLE\x20tmpExtractedResources\x20(','\x20\x20SET\x20u.userProfileId\x20=\x201','addColumn','\x20\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x20602\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20mail_accounts\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)','addIndex','\x20\x20\x20\x20SUBSTRING_INDEX(SUBSTRING_INDEX(t.userIds,\x20\x27,\x27,\x20tally.n),\x20\x27,\x27,\x20-1)\x20userId,','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201500\x20THEN\x20\x27DELETE\x27','\x20\x20INNER\x20JOIN\x20user_has_chat_websites\x20u\x20ON\x20u.UserId\x20=\x20x.userId','\x20\x20`id`\x20int(11)\x20NOT\x20NULL\x20AUTO_INCREMENT,','\x20\x20UNIQUE\x20KEY\x20`name`\x20(`name`)','INSERT\x20INTO\x20user_profile_has_sections\x20(name,\x20category,\x20sectionId,\x20enabled,\x20autoAssociation,\x20crudPermissions,\x20createdAt,\x20updatedAt,\x20userProfileId)','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20701\x20THEN\x20\x27SmsQueues\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20610\x20THEN\x20\x27Realtime\x27','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(801,\x20802,\x20810)\x20THEN\x20\x27Openchannel\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20801\x20THEN\x20\x27OpenchannelQueues\x27','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(901,\x20902,\x20910)\x20THEN\x20\x27Fax\x27','\x20\x20\x20\x20\x20\x20\x20\x20fp.profileId\x20profileId,','catch','DELETE\x20FROM\x20tmpNormalizedResources','\x20\x20SELECT\x20*\x20FROM\x20tmpSharedProfiles','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20tally\x20t','CREATE\x20TABLE\x20tmpPermissions','\x20\x20FROM\x20user_profiles\x20u','ALTER\x20TABLE\x20`users`\x20','INSERT\x20INTO\x20tmpSections','\x20\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x20701\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20sms_queues\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)','\x20\x20sectionId\x20int(11)\x20not\x20null,','join','inspect','changeColumn','\x20\x20WHERE\x20x.sectionId\x20=\x20902;','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(1001,\x201002,\x201003,\x201004,\x201005,\x201006,\x201007,\x201008,\x201009,\x201010,\x201011,\x201012)\x20THEN\x20\x27Tools\x27','\x20\x20SET\x20insertedId\x20=\x20(SELECT','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20603\x20THEN\x20\x27MailSubstatuses\x27','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201400\x20THEN\x20\x27Settings\x27','\x20\x20\x20\x20sectionId\x20int(11)\x20not\x20null,','VALUES\x20(\x27Default\x27,\x20\x27red\x27,\x20NULL,\x20NOW(),\x20NOW());','enqueue','FOREIGN\x20KEY\x20(`userProfileId`)\x20','INSERT\x20INTO\x20`user_profiles`\x20(`name`,\x20`crudPermissions`,\x20`description`,\x20`createdAt`,\x20`updatedAt`)','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201302\x20THEN\x20\x27SalesforceAccounts\x27','\x20\x20SELECT\x20permission,\x20userId,\x200','\x20\x20SELECT\x20x.sectionId,\x20u.VoiceQueueId,\x20x.userId','ADD\x20CONSTRAINT\x20`users_ibfk_1`\x20','\x20\x20SELECT\x20x.sectionId,\x20u.FaxQueueId,\x20x.userId','\x20\x20INNER\x20JOIN\x20user_has_mail_accounts\x20u\x20ON\x20u.UserId\x20=\x20x.userId','\x20\x20SELECT\x20x.sectionId,\x20u.ChatWebsiteId,\x20x.userId','\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20n)\x20AS\x20split;','CREATE\x20TABLE\x20tmpGroupedPermissions','\x20\x20INNER\x20JOIN\x20tmpExtractedResources\x20cr\x20ON\x20cr.userId\x20=\x20s.userId\x20AND\x20cr.sectionId\x20=\x20s.sectionId\x20AND\x20cr.resourceId\x20IS\x20NOT\x20NULL;','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20800\x20THEN\x20\x27DELETE\x27','\x20\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x201103\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20square_projects\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)','\x20\x20FROM\x20tmpSections','\x20\x20\x20\x20name\x20varchar(255)\x20not\x20null,','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20tmpNormalizedUsers','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201501\x20THEN\x20\x27QueueCampaigns\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20GROUP\x20BY\x20resourceId,\x20sectionId','\x20\x20\x20\x20userId\x20text','\x20\x20SELECT\x20x.sectionId,\x20u.SquareProjectId,\x20x.userId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20(select\x20SUBSTRING_INDEX(SUBSTRING_INDEX(r.userIds,\x20\x27,\x27,\x20t.n),\x20\x27,\x27,\x20-1)\x20userId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20),',')\x20ENGINE=InnoDB\x20DEFAULT\x20CHARSET=utf8;','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20POSITION(\x27,\x27\x20in\x20r.userIds)\x20>\x200','STRING','dropTable','\x20\x20SELECT\x20*','CREATE\x20TABLE\x20tmpNormalizedUsers','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(1401,\x201402,\x201403,\x201404,\x201405,\x201406,\x201407)\x20THEN\x20\x27DELETE\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20405\x20THEN\x20\x27Contexts\x27','INSERT\x20INTO\x20tmpGroupedPermissions','CREATE\x20TABLE\x20tmpCustomResources','finally','\x20\x20\x20\x20\x20\x20sectionId\x20int(11)','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20END','(SELECT\x200\x20AS\x20N\x20UNION\x20ALL\x20SELECT\x201\x20UNION\x20ALL\x20SELECT\x202\x20UNION\x20ALL\x20SELECT\x203\x20UNION\x20ALL\x20SELECT\x204\x20UNION\x20ALL\x20SELECT\x205\x20UNION\x20ALL\x20SELECT\x206\x20UNION\x20ALL\x20SELECT\x207\x20UNION\x20ALL\x20SELECT\x208\x20UNION\x20ALL\x20SELECT\x209)\x20a','\x20\x20WHERE\x20u.id\x20=\x20f.userId;','\x20\x20\x20\x20\x20\x20\x20\x20r.sectionId\x20sectionId','\x20\x20SET\x20name\x20=\x20(SELECT','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(501,\x20502,\x20510)\x20THEN\x20\x27Chat\x27','\x20\x20userId\x20int(11)','\x20\x20SELECT\x20name,\x20resourceId,\x20type,\x20now(),\x20now(),\x20insertedSectionId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20users)\x20b','\x20\x20`sectionId`\x20int(11)\x20NOT\x20NULL,','\x20\x20CROSS\x20JOIN\x20(SELECT\x20@cnt\x20:=\x201)\x20as\x20dummy\x20LIMIT\x201)','\x20\x20SELECT\x20x.sectionId,\x20u.MailQueueId,\x20x.userId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20CASE','\x20\x20FROM\x20tmpSections;','\x20\x20\x20\x20\x20\x20profileId\x20int(11)','UPDATE\x20tmpSections','ON\x20UPDATE\x20CASCADE','INSERT\x20INTO\x20tmpNormalizedSections','Removed\x20column\x20%s\x20from\x20%s','reportType','\x20\x20\x20\x20\x20\x20\x20\x20ELSE\x20\x27\x27','\x20\x20SELECT\x20x.sectionId,\x20u.OpenchannelQueueId,\x20x.userId','\x20\x20\x20\x20\x20\x20\x20\x20INNER\x20JOIN\x20tmpFinalProfiles\x20fp\x20ON\x20CHAR_LENGTH(fp.permissions)\x20-\x20CHAR_LENGTH(REPLACE(fp.permissions,\x20\x27,\x27,\x20\x27\x27))\x20>=\x20tally.n-1','\x20\x20FROM\x20users','\x20\x20s.sectionId\x20permission,','\x20\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x201501\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20voice_queues\x20WHERE\x20id\x20=\x20x.resourceId\x20AND\x20type\x20=\x20\x27outbound\x27),\x27DELETE_MIGRATION\x27)','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201700\x20THEN\x20\x27DELETE\x27','\x20\x20WHERE\x20x.sectionId\x20=\x20901;','\x20\x20`sectionId`\x20int(11)\x20DEFAULT\x20NULL,','\x20\x20\x20\x20\x20\x20WHEN\x20x.type\x20=\x20\x27CustomDashboards\x27\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20dashboards\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)','CREATE\x20TABLE\x20tmpFinalProfiles','\x20\x20\x20\x20\x20\x20CASE','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201202\x20THEN\x20\x27ExtractedReports\x27','\x20\x20WHERE\x20split.userId\x20IN\x20(SELECT\x20*\x20FROM','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20>=\x20100000\x20THEN\x20\x27CustomDashboards\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20902\x20THEN\x20\x27FaxAccounts\x27','\x20\x20WHERE\x20x.sectionId\x20=\x20801;','\x20\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x20502\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20chat_websites\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)','\x20\x20\x20\x20\x20\x20permissions\x20text\x20not\x20null','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20303\x20THEN\x20\x27Contacts\x27','CREATE\x20TABLE\x20`user_profile_has_sections`\x20(','SELECT\x20NULL\x20FROM','info','\x20\x20\x20\x20\x20\x20permissions\x20text\x20not\x20null,','then','\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20tally','queryInterface','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ELSE\x20\x27\x27','\x20\x20GROUP\x20BY\x20permissions','userProfileId','\x20\x20WHERE\x20x.sectionId\x20=\x20401\x20AND\x20q.type\x20=\x20\x27inbound\x27;','\x20\x20INNER\x20JOIN\x20user_has_sms_queues\x20u\x20ON\x20u.UserId\x20=\x20x.userId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201007\x20THEN\x20\x27Sounds\x27','\x20\x20WHERE\x20x.sectionId\x20=\x20502;','\x20\x20\x20\x20\x20\x20\x20\x20SUBSTRING_INDEX(SUBSTRING_INDEX(r.resourceId,\x20\x27,\x27,\x20tally.n),\x20\x27,\x27,\x20-1)\x20resourceId,','\x20\x20SELECT\x20\x27\x27,\x20resourceId,\x20type,\x20insertedSectionId,\x20sectionId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20101\x20THEN\x20\x27DELETE\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20);','\x20\x20KEY\x20`userProfileId`\x20(`userProfileId`),','\x20\x20WHERE\x20x.sectionId\x20=\x20701;','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201510\x20THEN\x20\x27Realtime\x27','\x20\x20\x20\x20category\x20varchar(255)\x20not\x20null,','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20302\x20THEN\x20\x27Companies\x27','\x20\x20\x20\x20\x20\x20WHEN\x20x.type\x20=\x20\x27Plugins\x27\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20plugins\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)','\x20\x20`createdAt`\x20datetime\x20NOT\x20NULL,','\x20\x20SET\x20insertedId\x20=\x20(SELECT\x20id','\x20\x20FROM\x20tmpNormalizedUsers\x20x','\x20\x20SELECT\x20x.sectionId,\x20u.MailAccountId,\x20x.userId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201308\x20THEN\x20\x27VtigerAccounts\x27','prototype','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20501\x20THEN\x20\x27ChatQueues\x27','\x20\x20`updatedAt`\x20datetime\x20NOT\x20NULL,','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20403\x20THEN\x20\x27OutboundRoutes\x27','migration','\x20\x20CROSS\x20JOIN\x20(SELECT\x20@cnt\x20:=\x200)\x20as\x20dummy\x20LIMIT\x201)),\x20\x27red\x27,\x20now(),\x20now()','\x20\x20\x20\x20\x20\x20\x20\x20r.insertedSectionId\x20insertedSectionId,','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20position(\x27,\x27\x20in\x20b.users)\x20=\x200))','\x20\x20`enabled`\x20tinyint(1)\x20DEFAULT\x20NULL,','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(SELECT\x20GROUP_CONCAT(userId\x20ORDER\x20BY\x20userId\x20ASC)\x20as\x20users','\x20\x20ORDER\x20BY\x20n)\x20AS\x20split;','\x20\x20SELECT\x20\x27\x27,\x20insertedId,\x20name,\x20sectionId,\x20null','\x20\x20SELECT\x20x.sectionId,\x20u.OpenchannelAccountId,\x20x.userId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20900\x20THEN\x20\x27DELETE\x27','\x20\x20FROM\x20tmpCustomResources;','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20(SELECT','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20END','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201300\x20THEN\x20\x27DELETE\x27','sequelize','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20301\x20THEN\x20\x27Lists\x27','renameColumn','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20802\x20THEN\x20\x27OpenchannelAccounts\x27','\x20\x20`autoAssociation`\x20tinyint(1)\x20DEFAULT\x20NULL,','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20411\x20THEN\x20\x27Realtime\x27','\x20\x20`type`\x20varchar(255)\x20NOT\x20NULL,','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(1101,\x201102,\x201103)\x20THEN\x20\x27CallySquare\x27','\x20\x20\x20\x20autoAssociation\x20tinyint\x20not\x20null,','\x20\x20);','\x20\x20ORDER\x20BY\x20userId;','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20s.userProfileId\x20=\x20x.userProfileId\x20AND\x20s.sectionId\x20=\x20x.sectionId);','\x20\x20WHERE\x20x.sectionId\x20=\x20802;','\x20\x20SET\x20autoAssociation\x20=\x201\x20WHERE\x20sectionId\x20=\x20100;','\x20\x20WHERE\x20x.sectionId\x20=\x201501\x20AND\x20q.type\x20=\x20\x27outbound\x27;','\x20\x20FROM\x20tmpNormalizedSections','\x20\x20SELECT\x20id,\x20permissions,\x20null','\x20\x20WHERE\x20x.sectionId\x20=\x20702;','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201200\x20THEN\x20\x27DELETE\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201008\x20THEN\x20\x27Tags\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201012\x20THEN\x20\x27Variables\x27','util','\x20\x20INNER\x20JOIN\x20user_has_chat_queues\x20u\x20ON\x20u.UserId\x20=\x20x.userId','CREATE\x20TABLE\x20`user_profile_has_resources`\x20(','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20407\x20THEN\x20\x27MusicOnHolds\x27','removeIndex','\x20\x20SELECT\x20GROUP_CONCAT(id),\x20permissions,\x20null','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(1501,\x201502,\x201510)\x20THEN\x20\x27MotionDialer\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20510\x20THEN\x20\x27Realtime\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20406\x20THEN\x20\x27Voicemails\x27','INSERT\x20INTO\x20user_profile_has_resources\x20(name,\x20resourceId,\x20type,\x20createdAt,\x20updatedAt,\x20sectionId)','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201301\x20THEN\x20\x27ZendeskAccounts\x27','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20>=\x20100000\x20THEN\x20\x27Tools\x27','\x20\x20ORDER\x20BY\x20GROUP_CONCAT(userId);','\x20\x20SELECT\x20x.sectionId,\x20u.ChatQueueId,\x20x.userId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201600\x20THEN\x20\x27Help\x27','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20between\x2088889\x20AND\x2099999\x20THEN\x20\x27Plugins\x27','\x20\x20INNER\x20JOIN\x20user_has_mail_queues\x20u\x20ON\x20u.UserId\x20=\x20x.userId','TRUNCATE\x20TABLE\x20tmpPermissions;','tail',',(SELECT\x200\x20AS\x20N\x20UNION\x20ALL\x20SELECT\x201\x20UNION\x20ALL\x20SELECT\x202\x20UNION\x20ALL\x20SELECT\x203\x20UNION\x20ALL\x20SELECT\x204\x20UNION\x20ALL\x20SELECT\x205\x20UNION\x20ALL\x20SELECT\x206\x20UNION\x20ALL\x20SELECT\x207\x20UNION\x20ALL\x20SELECT\x208\x20UNION\x20ALL\x20SELECT\x209)\x20e','\x20\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x20601\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20mail_queues\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)','removeIndex\x20%s\x20%s','CREATE\x20TABLE\x20tally\x20(','\x20\x20CONSTRAINT\x20`user_profile_has_sections_ibfk_1`\x20FOREIGN\x20KEY\x20(`userProfileId`)\x20REFERENCES\x20`user_profiles`\x20(`id`)\x20ON\x20DELETE\x20CASCADE\x20ON\x20UPDATE\x20CASCADE','\x20\x20SET\x20profileId\x20=\x20(SELECT\x20(@cnt\x20:=\x20@cnt\x20+\x201)\x20AS\x20rowNumber','\x20\x20FROM\x20(SELECT','\x20\x20WHERE\x20userProfileId\x20is\x20null\x20AND\x20role\x20=\x20\x27user\x27;','\x20\x20FROM\x20tmpFinalProfiles;','INSERT\x20INTO\x20user_profiles\x20(name,\x20crudPermissions,\x20createdAt,\x20updatedAt)','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201103\x20THEN\x20\x27SquareProjects\x27','\x20\x20KEY\x20`compositeIndex`\x20(`sectionId`,`userProfileId`),','INSERT\x20INTO\x20tmpResources','\x20\x20\x20\x20sectionId\x20int(11)','UPDATE\x20tmpNormalizedResources\x20x','\x20\x20SELECT\x20DISTINCT\x20permission,\x20userId,\x200','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201005\x20THEN\x20\x27Pauses\x27','\x20\x20`userProfileId`\x20int(11)\x20DEFAULT\x20NULL,','stringify','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(1201,\x201202,\x201203)\x20THEN\x20\x27Analytics\x27','\x20\x20FROM\x20tmpSections\x20s','final','\x20\x20INNER\x20JOIN\x20user_has_openchannel_queues\x20u\x20ON\x20u.UserId\x20=\x20x.userId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20GROUP\x20BY\x20resourceId,\x20sectionId','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20);','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201100\x20THEN\x20\x27DELETE\x27','\x20\x20UNION','INSERT\x20INTO\x20tmpSingleProfiles','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20910\x20THEN\x20\x27Realtime\x27','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpPermissions;','\x20\x20(','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20CASE','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpExtractedResources;','INSERT\x20INTO\x20tmpFinalProfiles','\x20\x20FROM\x20tmpGroupedPermissions','\x20\x20`category`\x20varchar(255)\x20NOT\x20NULL,','\x20\x20SELECT\x20x.sectionId,\x20u.SmsQueueId,\x20x.userId','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpNormalizedResources;','Renamed\x20column\x20from\x20%s\x20to\x20%s\x20on\x20%s','\x20\x20\x20\x20\x20\x20\x20\x20SUBSTRING_INDEX(fp.userId,\x20\x27,\x27,\x201)\x20userId','CREATE\x20TABLE\x20tmpResources','\x20\x20KEY\x20`sectionId`\x20(`sectionId`),','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201001\x20THEN\x20\x27CannedAnswers\x27','\x20\x20\x20\x20\x20\x20resourceId\x20text,','\x20\x20\x20\x20enabled\x20tinyint\x20not\x20null,','\x20\x20\x20\x20\x20\x20\x20\x20INNER\x20JOIN\x20tmpResources\x20r\x20ON\x20CHAR_LENGTH(r.resourceId)\x20-\x20CHAR_LENGTH(REPLACE(r.resourceId,\x20\x27,\x27,\x20\x27\x27))\x20>=\x20tally.n-1','\x20\x20GROUP\x20BY\x20userId;','\x20\x20\x20\x20\x20\x20userIds\x20varchar(255)\x20not\x20null,','\x20\x20SET\x20sectionId\x20=\x201801\x20WHERE\x20sectionId\x20between\x2088889\x20AND\x2099999;','\x20\x20FROM\x20tally\x20INNER\x20JOIN\x20tmpPermissions\x20p\x20ON\x20CHAR_LENGTH(p.permissions)\x20-\x20CHAR_LENGTH(REPLACE(p.permissions,\x20\x27,\x27,\x20\x27\x27))\x20>=\x20tally.n-1','\x20\x20ORDER\x20BY\x20id;','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpNormalizedSections;','INTEGER','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20410\x20THEN\x20\x27VoicePrefixes\x27','INSERT\x20INTO\x20tmpNormalizedResources','\x20\x20`resourceId`\x20int(11)\x20NOT\x20NULL,','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201011\x20THEN\x20\x27Trunks\x27','name','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201307\x20THEN\x20\x27ZohoAccounts\x27','\x20\x20FROM\x20tally\x20t\x20INNER\x20JOIN\x20tmpNormalizedSections\x20s\x20ON\x20CHAR_LENGTH(s.userId)\x20-\x20CHAR_LENGTH(REPLACE(s.userId,\x20\x27,\x27,\x20\x27\x27))\x20>=\x20t.n-1','\x20\x20\x20\x20\x20\x20\x20\x20SUBSTRING_INDEX(SUBSTRING_INDEX(fp.permissions,\x20\x27,\x27,\x20tally.n),\x20\x27,\x27,\x20-1)\x20permission,','\x20\x20SELECT\x20name,\x20category,\x20sectionId,\x20enabled,\x20autoAssociation,\x20\x27red\x27,\x20now(),\x20now(),\x20userProfileId','REFERENCES\x20user_profiles(`id`)\x20','\x20\x20INNER\x20JOIN\x20user_has_square_projects\x20u\x20ON\x20u.UserId\x20=\x20x.userId','UPDATE\x20tmpCustomResources','\x20\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x20901\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20fax_queues\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201101\x20THEN\x20\x27ODBC\x27','query\x20%s','\x20\x20\x20\x20\x20\x20WHEN\x20name\x20=\x20\x27Plugins\x27\x20THEN\x20(sectionId\x20-\x2088888)','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20200\x20THEN\x20\x27DELETE\x27','\x20\x20SELECT\x20GROUP_CONCAT(sectionId\x20ORDER\x20BY\x20sectionId),\x20userId','\x20\x20WHERE\x20userId\x20IN\x20(SELECT\x20split.userId','INSERT\x20INTO\x20tmpPermissions'];(function(_0x100279,_0x78819e){const _0x11f381=function(_0x3ddaf3){while(--_0x3ddaf3){_0x100279['push'](_0x100279['shift']());}};_0x11f381(++_0x78819e);}(a1128_0x11f3,0x150));const a1128_0x3dda=function(_0x100279,_0x78819e){_0x100279=_0x100279-0x6b;let _0x11f381=a1128_0x11f3[_0x100279];return _0x11f381;};const a1128_0x3ba380=a1128_0x3dda;'use strict';const util=require(a1128_0x3ba380(0x175)),logger=require(a1128_0x3ba380(0x8e))(a1128_0x3ba380(0x152)),Sequence=function(){};Sequence[a1128_0x3ba380(0x14e)]['enqueue']=function(_0x631349){const _0x1f37fa=a1128_0x3ba380;this['tail']=this[_0x1f37fa(0x187)]?this[_0x1f37fa(0x187)][_0x1f37fa(0x107)](_0x631349):_0x631349();};const Migration=function(_0xbd752){this['queryInterface']=_0xbd752,this['sequence']=new Sequence();};Migration[a1128_0x3ba380(0x14e)][a1128_0x3ba380(0xdd)]=function(_0x346a05,_0x39eb57,_0x5bfd18){const _0x1b4e56=a1128_0x3ba380,_0x57bc13=this;this[_0x1b4e56(0x7d)][_0x1b4e56(0xe5)](function(){const _0x3728d9=_0x1b4e56;return _0x57bc13['queryInterface']['changeColumn'](_0x346a05,_0x39eb57,_0x5bfd18)[_0x3728d9(0x135)](function(){const _0x37f9fa=_0x3728d9;logger[_0x37f9fa(0x133)]('Changed\x20column\x20%s\x20in\x20table\x20%s',_0x39eb57,_0x346a05);})[_0x3728d9(0xd1)](function(_0x50ed3d){const _0xd6a8be=_0x3728d9;logger['info'](JSON[_0xd6a8be(0x19a)](_0x50ed3d));});});},Migration[a1128_0x3ba380(0x14e)][a1128_0x3ba380(0xc2)]=function(_0x107f96,_0x27aa28,_0x596516){const _0xf6701e=a1128_0x3ba380,_0x92048e=this;this[_0xf6701e(0x7d)][_0xf6701e(0xe5)](function(){const _0x57faef=_0xf6701e;return _0x92048e[_0x57faef(0x137)][_0x57faef(0xc2)](_0x107f96,_0x27aa28,_0x596516)['then'](function(){logger['info']('Added\x20column\x20%s\x20to\x20%s',_0x27aa28,_0x107f96);})[_0x57faef(0xd1)](function(_0x65c2ba){const _0xc229d=_0x57faef;logger['info'](JSON[_0xc229d(0x19a)](_0x65c2ba));});});},Migration[a1128_0x3ba380(0x14e)][a1128_0x3ba380(0x100)]=function(_0x2593cc){const _0x14e683=a1128_0x3ba380,_0x54ad12=this;this[_0x14e683(0x7d)][_0x14e683(0xe5)](function(){const _0x831736=_0x14e683;return _0x54ad12[_0x831736(0x137)][_0x831736(0x100)](_0x2593cc,{'force':!![]})[_0x831736(0x135)](function(){const _0x303ea1=_0x831736;logger[_0x303ea1(0x133)]('table\x20dropped\x20%s',_0x2593cc);})['catch'](function(_0x5d5fe9){const _0x475812=_0x831736;logger[_0x475812(0x133)](JSON['stringify'](_0x5d5fe9));});});},Migration[a1128_0x3ba380(0x14e)][a1128_0x3ba380(0xc4)]=function(_0x4b4520,_0x1a3634,_0x584939){const _0x118dd9=a1128_0x3ba380,_0x42dbf7=this;this[_0x118dd9(0x7d)][_0x118dd9(0xe5)](function(){const _0x4fc939=_0x118dd9;return _0x42dbf7[_0x4fc939(0x137)][_0x4fc939(0xc4)](_0x4b4520,_0x1a3634,{'indexName':_0x584939})['then'](function(){const _0x1e67ce=_0x4fc939;logger[_0x1e67ce(0x133)](_0x1e67ce(0x84),_0x4b4520,_0x1a3634[_0x1e67ce(0xdb)](','),_0x584939);})[_0x4fc939(0xd1)](function(_0x5bf085){const _0x3e1d75=_0x4fc939;logger[_0x3e1d75(0x133)](JSON['stringify'](_0x5bf085));});});},Migration['prototype'][a1128_0x3ba380(0x179)]=function(_0x32367d,_0x5267e9){const _0x52b1ec=a1128_0x3ba380,_0x30611d=this;this[_0x52b1ec(0x7d)][_0x52b1ec(0xe5)](function(){const _0xcba663=_0x52b1ec;return _0x30611d[_0xcba663(0x137)][_0xcba663(0x179)](_0x32367d,_0x5267e9)[_0xcba663(0x135)](function(){const _0x39886e=_0xcba663;logger['info'](_0x39886e(0x18a),_0x32367d,_0x5267e9);})[_0xcba663(0xd1)](function(_0x15baf4){const _0x4616b=_0xcba663;logger[_0x4616b(0x133)](JSON['stringify'](_0x15baf4));});});},Migration[a1128_0x3ba380(0x14e)]['query']=function(_0x3218c1){const _0x1b8f88=a1128_0x3ba380,_0x3df612=this;this[_0x1b8f88(0x7d)]['enqueue'](function(){const _0x509680=_0x1b8f88;return _0x3df612[_0x509680(0x137)][_0x509680(0x160)][_0x509680(0x8c)](_0x3218c1)['then'](function(){const _0x228069=_0x509680;logger[_0x228069(0x133)](_0x228069(0x70),_0x3218c1);})['catch'](function(_0xcbe574){const _0x3ef0a3=_0x509680;logger['info'](JSON[_0x3ef0a3(0x19a)](_0xcbe574));});});},Migration['prototype'][a1128_0x3ba380(0x90)]=function(_0x3b4325,_0x4fac9b){const _0x221e28=a1128_0x3ba380,_0x17e9ef=this;this[_0x221e28(0x7d)]['enqueue'](function(){const _0xe000e0=_0x221e28;return _0x17e9ef[_0xe000e0(0x137)][_0xe000e0(0x90)](_0x3b4325,_0x4fac9b)[_0xe000e0(0x135)](function(){const _0x48cf04=_0xe000e0;logger[_0x48cf04(0x133)](_0x48cf04(0x11b),_0x4fac9b,_0x3b4325);})[_0xe000e0(0xd1)](function(_0xedf1f0){const _0x3143be=_0xe000e0;logger[_0x3143be(0x133)](util[_0x3143be(0xdc)](_0xedf1f0,{'showHidden':![],'depth':null}));});});},Migration[a1128_0x3ba380(0x14e)]['renameColumn']=function(_0x44dc6d,_0x2d5712,_0xba715b){const _0x5ae664=a1128_0x3ba380,_0x29f149=this;this[_0x5ae664(0x7d)][_0x5ae664(0xe5)](function(){const _0x489c91=_0x5ae664;return _0x29f149['queryInterface'][_0x489c91(0x162)](_0x44dc6d,_0x2d5712,_0xba715b)[_0x489c91(0x135)](function(){const _0x47418f=_0x489c91;logger[_0x47418f(0x133)](_0x47418f(0x1ae),_0x2d5712,_0xba715b,_0x44dc6d);})[_0x489c91(0xd1)](function(_0x457fa2){const _0x1d3111=_0x489c91;logger['info'](util[_0x1d3111(0xdc)](_0x457fa2,{'showHidden':![],'depth':null}));});});},Migration['prototype'][a1128_0x3ba380(0x19d)]=function(_0x4bb174){const _0x58f938=a1128_0x3ba380;this[_0x58f938(0x7d)][_0x58f938(0xe5)](function(){return _0x4bb174();});},module['exports']={'up':function(_0x52c6a3,_0x196ef6){return new Promise(function(_0x15be51){const _0x2bba5f=a1128_0x3dda,_0x5482c7=new Migration(_0x52c6a3);_0x5482c7[_0x2bba5f(0xc2)]('analytics_extracted_reports','reportId',{'type':_0x196ef6[_0x2bba5f(0x1bc)]}),_0x5482c7[_0x2bba5f(0xc2)]('analytics_extracted_reports',_0x2bba5f(0x11c),{'type':_0x196ef6[_0x2bba5f(0xff)]}),_0x5482c7['addColumn'](_0x2bba5f(0xa3),_0x2bba5f(0x13a),{'type':_0x196ef6[_0x2bba5f(0x1bc)]}),_0x5482c7[_0x2bba5f(0x90)]('voice_voicemail',_0x2bba5f(0x1c1)),_0x5482c7[_0x2bba5f(0x8c)]('CREATE\x20TABLE\x20`user_profiles`\x20('+'\x20\x20`id`\x20int(11)\x20NOT\x20NULL\x20AUTO_INCREMENT,'+'\x20\x20`name`\x20varchar(255)\x20NOT\x20NULL,'+'\x20\x20`crudPermissions`\x20varchar(255)\x20NOT\x20NULL\x20DEFAULT\x20\x27r\x27,'+'\x20\x20`description`\x20varchar(255)\x20DEFAULT\x20NULL,'+_0x2bba5f(0x149)+_0x2bba5f(0x150)+_0x2bba5f(0xa5)+_0x2bba5f(0xc9)+_0x2bba5f(0xfd)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xe7)+_0x2bba5f(0xe4)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xd7)+_0x2bba5f(0xeb)+_0x2bba5f(0xe6)+_0x2bba5f(0x6b)+_0x2bba5f(0x119)),_0x5482c7['query'](_0x2bba5f(0x131)+'\x20\x20`id`\x20int(11)\x20NOT\x20NULL\x20AUTO_INCREMENT,'+_0x2bba5f(0xbb)+_0x2bba5f(0x1ab)+_0x2bba5f(0x112)+_0x2bba5f(0x156)+_0x2bba5f(0x164)+'\x20\x20`crudPermissions`\x20varchar(255)\x20DEFAULT\x20NULL,'+'\x20\x20`createdAt`\x20datetime\x20NOT\x20NULL,'+_0x2bba5f(0x150)+_0x2bba5f(0x199)+_0x2bba5f(0xa5)+_0x2bba5f(0x143)+_0x2bba5f(0x193)+_0x2bba5f(0x18c)+_0x2bba5f(0xfd)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x177)+_0x2bba5f(0xc8)+'\x20\x20`name`\x20varchar(255)\x20NOT\x20NULL,'+_0x2bba5f(0x1bf)+_0x2bba5f(0x166)+'\x20\x20`createdAt`\x20datetime\x20NOT\x20NULL,'+_0x2bba5f(0x150)+_0x2bba5f(0x125)+_0x2bba5f(0xa5)+_0x2bba5f(0x1b1)+'\x20\x20KEY\x20`compositeIndex`\x20(`resourceId`,`sectionId`),'+'\x20\x20CONSTRAINT\x20`user_profile_has_resources_ibfk_1`\x20FOREIGN\x20KEY\x20(`sectionId`)\x20REFERENCES\x20`user_profile_has_sections`\x20(`id`)\x20ON\x20DELETE\x20CASCADE\x20ON\x20UPDATE\x20CASCADE'+_0x2bba5f(0xfd)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x18b)+'\x20\x20n\x20INT\x20NOT\x20NULL\x20AUTO_INCREMENT\x20PRIMARY\x20KEY'+');'),_0x5482c7['query']('INSERT\x20INTO\x20tally\x20(n)'+_0x2bba5f(0x132)+_0x2bba5f(0x10a)+',(SELECT\x200\x20AS\x20N\x20UNION\x20ALL\x20SELECT\x201\x20UNION\x20ALL\x20SELECT\x202\x20UNION\x20ALL\x20SELECT\x203\x20UNION\x20ALL\x20SELECT\x204\x20UNION\x20ALL\x20SELECT\x205\x20UNION\x20ALL\x20SELECT\x206\x20UNION\x20ALL\x20SELECT\x207\x20UNION\x20ALL\x20SELECT\x208\x20UNION\x20ALL\x20SELECT\x209)\x20b'+_0x2bba5f(0xb8)+',(SELECT\x200\x20AS\x20N\x20UNION\x20ALL\x20SELECT\x201\x20UNION\x20ALL\x20SELECT\x202\x20UNION\x20ALL\x20SELECT\x203\x20UNION\x20ALL\x20SELECT\x204\x20UNION\x20ALL\x20SELECT\x205\x20UNION\x20ALL\x20SELECT\x206\x20UNION\x20ALL\x20SELECT\x207\x20UNION\x20ALL\x20SELECT\x208\x20UNION\x20ALL\x20SELECT\x209)\x20d'+_0x2bba5f(0x188)+';'),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xd5)+_0x2bba5f(0x1a6)+_0x2bba5f(0x1b7)+_0x2bba5f(0x134)+_0x2bba5f(0x117)+'\x20\x20);'),_0x5482c7['query'](_0x2bba5f(0x75)+_0x2bba5f(0x170)+_0x2bba5f(0x120)+_0x2bba5f(0xa7)+_0x2bba5f(0x1ba)),_0x5482c7[_0x2bba5f(0x8c)]('CREATE\x20TABLE\x20tmpNormalizedSections'+'\x20\x20('+_0x2bba5f(0xe3)+_0x2bba5f(0x7f)+_0x2bba5f(0xa9)+_0x2bba5f(0x169)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x11a)+_0x2bba5f(0x197)+_0x2bba5f(0x18e)+'\x20\x20\x20\x20SUBSTRING_INDEX(SUBSTRING_INDEX(p.permissions,\x20\x27,\x27,\x20tally.n),\x20\x27,\x27,\x20-1)\x20permission,'+'\x20\x20\x20\x20p.userIds\x20userId'+_0x2bba5f(0x1b9)+_0x2bba5f(0x158)),_0x5482c7[_0x2bba5f(0x8c)]('CREATE\x20TABLE\x20tmpNormalizedPermissions'+'\x20\x20('+'\x20\x20\x20\x20permissions\x20text\x20not\x20null,'+_0x2bba5f(0x92)+'\x20\x20);'),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x96)+_0x2bba5f(0x73)+_0x2bba5f(0x16f)+_0x2bba5f(0x1b6)),_0x5482c7[_0x2bba5f(0x8c)]('UPDATE\x20users\x20u,\x20tmpNormalizedPermissions\x20t'+'\x20\x20SET\x20u.permissions\x20=\x20t.permissions'+'\x20\x20WHERE\x20u.id\x20=\x20t.userId;'),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x186)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x75)+_0x2bba5f(0x17a)+_0x2bba5f(0x120)+_0x2bba5f(0xa7)+'\x20\x20GROUP\x20BY\x20permissions'+_0x2bba5f(0x77)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x102)+'\x20\x20('+_0x2bba5f(0xe3)+_0x2bba5f(0x7f)+'\x20\x20\x20\x20resourceId\x20text'+_0x2bba5f(0x169)),_0x5482c7[_0x2bba5f(0x8c)]('INSERT\x20INTO\x20tmpNormalizedUsers'+_0x2bba5f(0xe9)+'\x20\x20FROM\x20(SELECT'+_0x2bba5f(0x121)+_0x2bba5f(0xac)+_0x2bba5f(0x1c3)+'\x20\x20ORDER\x20BY\x20n)\x20AS\x20split;'),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xc0)+_0x2bba5f(0xda)+_0x2bba5f(0xb0)+_0x2bba5f(0x10f)+_0x2bba5f(0x169)),_0x5482c7['query'](_0x2bba5f(0xb2)+_0x2bba5f(0xea)+'\x20\x20FROM\x20tmpNormalizedUsers\x20x'+_0x2bba5f(0xb3)+'\x20\x20INNER\x20JOIN\x20voice_queues\x20q\x20ON\x20u.VoiceQueueId\x20=\x20q.id'+_0x2bba5f(0x13b)),_0x5482c7['query']('INSERT\x20INTO\x20tmpExtractedResources'+_0x2bba5f(0x182)+_0x2bba5f(0x14b)+_0x2bba5f(0x176)+_0x2bba5f(0x83)),_0x5482c7[_0x2bba5f(0x8c)]('INSERT\x20INTO\x20tmpExtractedResources'+_0x2bba5f(0xee)+_0x2bba5f(0x14b)+_0x2bba5f(0xc7)+_0x2bba5f(0x13e)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xb2)+_0x2bba5f(0x114)+'\x20\x20FROM\x20tmpNormalizedUsers\x20x'+_0x2bba5f(0x185)+_0x2bba5f(0xa1)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xb2)+_0x2bba5f(0x14c)+_0x2bba5f(0x14b)+_0x2bba5f(0xed)+'\x20\x20WHERE\x20x.sectionId\x20=\x20602;'),_0x5482c7['query'](_0x2bba5f(0xb2)+_0x2bba5f(0x1ac)+_0x2bba5f(0x14b)+_0x2bba5f(0x13c)+_0x2bba5f(0x144)),_0x5482c7['query'](_0x2bba5f(0xb2)+_0x2bba5f(0x7a)+'\x20\x20FROM\x20tmpNormalizedUsers\x20x'+'\x20\x20INNER\x20JOIN\x20user_has_sms_accounts\x20u\x20ON\x20u.UserId\x20=\x20x.userId'+_0x2bba5f(0x171)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xb2)+_0x2bba5f(0x11e)+_0x2bba5f(0x14b)+_0x2bba5f(0x19e)+_0x2bba5f(0x12d)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xb2)+_0x2bba5f(0x15a)+'\x20\x20FROM\x20tmpNormalizedUsers\x20x'+_0x2bba5f(0xb9)+_0x2bba5f(0x16c)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xb2)+_0x2bba5f(0xec)+_0x2bba5f(0x14b)+_0x2bba5f(0x8a)+_0x2bba5f(0x124)),_0x5482c7[_0x2bba5f(0x8c)]('INSERT\x20INTO\x20tmpExtractedResources'+_0x2bba5f(0x9e)+_0x2bba5f(0x14b)+'\x20\x20INNER\x20JOIN\x20user_has_fax_accounts\x20u\x20ON\x20u.UserId\x20=\x20x.userId'+_0x2bba5f(0xde)),_0x5482c7['query']('INSERT\x20INTO\x20tmpExtractedResources'+_0x2bba5f(0xfa)+_0x2bba5f(0x14b)+_0x2bba5f(0x6c)+_0x2bba5f(0x91)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xb2)+'\x20\x20SELECT\x20x.sectionId,\x20u.VoiceQueueId,\x20x.userId'+_0x2bba5f(0x14b)+_0x2bba5f(0xb3)+_0x2bba5f(0x9b)+_0x2bba5f(0x16e)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xf0)+'\x20\x20('+'\x20\x20\x20\x20\x20\x20userId\x20text\x20not\x20null,'+_0x2bba5f(0x12f)+_0x2bba5f(0x169)),_0x5482c7['query'](_0x2bba5f(0x105)+'\x20\x20SELECT\x20userId,\x20permissions'+_0x2bba5f(0x18e)+_0x2bba5f(0xc5)+'\x20\x20\x20\x20t.permissions\x20permissions'+'\x20\x20FROM\x20tally\x20INNER\x20JOIN\x20tmpPermissions\x20t\x20ON\x20CHAR_LENGTH(t.userIds)\x20-\x20CHAR_LENGTH(REPLACE(t.userIds,\x20\x27,\x27,\x20\x27\x27))\x20>=\x20tally.n-1'+_0x2bba5f(0x158)),_0x5482c7[_0x2bba5f(0x8c)]('CREATE\x20TABLE\x20tmpSharedProfiles'+_0x2bba5f(0x1a6)+_0x2bba5f(0x1b7)+_0x2bba5f(0x134)+_0x2bba5f(0x117)+'\x20\x20);'),_0x5482c7[_0x2bba5f(0x8c)]('INSERT\x20INTO\x20tmpSharedProfiles'+'\x20\x20SELECT\x20GROUP_CONCAT(userId),\x20permissions,\x20null'+_0x2bba5f(0x1aa)+'\x20\x20WHERE\x20userId\x20NOT\x20IN\x20(SELECT\x20split.userId'+_0x2bba5f(0x15d)+_0x2bba5f(0xab)+_0x2bba5f(0xd4)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20INNER\x20JOIN\x20tmpPermissions\x20r\x20on\x20CHAR_LENGTH(r.userIds)\x20-\x20CHAR_LENGTH(REPLACE(r.userIds,\x20\x27,\x27,\x20\x27\x27))\x20>=\x20t.n-1'+_0x2bba5f(0x9d)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20n)\x20AS\x20split'+'\x20\x20WHERE\x20split.userId\x20IN\x20(SELECT\x20*\x20FROM'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(SELECT\x20GROUP_CONCAT(userId\x20ORDER\x20BY\x20userId\x20ASC)\x20AS\x20users'+_0x2bba5f(0x89)+_0x2bba5f(0x19f)+_0x2bba5f(0x111)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHERE\x20position(\x27,\x27\x20in\x20b.users)\x20=\x200))'+_0x2bba5f(0x139)+_0x2bba5f(0x181)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xb5)+_0x2bba5f(0x1a6)+_0x2bba5f(0xb4)+_0x2bba5f(0x134)+'\x20\x20\x20\x20\x20\x20profileId\x20int(11)'+'\x20\x20);'),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x1a3)+_0x2bba5f(0xaa)+_0x2bba5f(0x1aa)+_0x2bba5f(0x74)+_0x2bba5f(0xfb)+_0x2bba5f(0x7b)+_0x2bba5f(0xfe)+_0x2bba5f(0xbf)+_0x2bba5f(0x12a)+_0x2bba5f(0x157)+_0x2bba5f(0xf6)+_0x2bba5f(0xf8)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20users)\x20b'+_0x2bba5f(0x155)+_0x2bba5f(0x16a)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x127)+'\x20\x20('+'\x20\x20\x20\x20\x20\x20userId\x20text\x20not\x20null,'+_0x2bba5f(0x134)+'\x20\x20\x20\x20\x20\x20profileId\x20int(11)'+_0x2bba5f(0x169)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x1a9)+_0x2bba5f(0xd3)+_0x2bba5f(0x1a2)+'\x20\x20SELECT\x20*\x20FROM\x20tmpSingleProfiles;'),_0x5482c7['query'](_0x2bba5f(0x191)+'\x20\x20SELECT\x20CONCAT(\x27Profile_\x27,\x20(SELECT\x20(@cnt\x20:=\x20@cnt\x20+\x201)\x20AS\x20rowNumber'+'\x20\x20FROM\x20tmpFinalProfiles\x20t'+_0x2bba5f(0x153)+_0x2bba5f(0x190)),_0x5482c7[_0x2bba5f(0x8c)]('UPDATE\x20tmpFinalProfiles'+_0x2bba5f(0x18d)+_0x2bba5f(0xd6)+_0x2bba5f(0x113)),_0x5482c7['query']('CREATE\x20TABLE\x20tmpSections'+_0x2bba5f(0x1a6)+'\x20\x20\x20\x20name\x20varchar(255)\x20not\x20null,'+_0x2bba5f(0x146)+'\x20\x20\x20\x20sectionId\x20int(11)\x20not\x20null,'+_0x2bba5f(0x1b4)+_0x2bba5f(0x168)+_0x2bba5f(0x8f)+'\x20\x20\x20\x20insertedId\x20int(11),'+_0x2bba5f(0xf9)+_0x2bba5f(0x169)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xd8)+_0x2bba5f(0xa2)+'\x20\x20FROM\x20(SELECT'+_0x2bba5f(0xd0)+_0x2bba5f(0x1c4)+_0x2bba5f(0x1af)+_0x2bba5f(0x136)+_0x2bba5f(0x11f)+'\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20n)\x20AS\x20split;'),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x118)+'\x20\x20SET'+'\x20\x20\x20\x20\x20\x20name\x20=\x20(SELECT'+_0x2bba5f(0x1a7)+_0x2bba5f(0x7c)+_0x2bba5f(0x141)+_0x2bba5f(0x72)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20201\x20THEN\x20\x27DELETE\x27'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20202\x20THEN\x20\x27Agents\x27'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20203\x20THEN\x20\x27Telephones\x27'+_0x2bba5f(0xbe)+_0x2bba5f(0xb1)+_0x2bba5f(0x161)+_0x2bba5f(0x147)+_0x2bba5f(0x130)+_0x2bba5f(0x8b)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20400\x20THEN\x20\x27DELETE\x27'+_0x2bba5f(0xb7)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20402\x20THEN\x20\x27InboundRoutes\x27'+_0x2bba5f(0x151)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20404\x20THEN\x20\x27InternalRoutes\x27'+_0x2bba5f(0x104)+_0x2bba5f(0x17d)+_0x2bba5f(0x178)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20408\x20THEN\x20\x27VoiceRecordings\x27'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20409\x20THEN\x20\x27ChanSpies\x27'+_0x2bba5f(0x1bd)+_0x2bba5f(0x165)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20500\x20THEN\x20\x27DELETE\x27'+_0x2bba5f(0x14f)+_0x2bba5f(0xba)+_0x2bba5f(0x17c)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20600\x20THEN\x20\x27DELETE\x27'+_0x2bba5f(0xa4)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20602\x20THEN\x20\x27MailAccounts\x27'+_0x2bba5f(0xe1)+_0x2bba5f(0xcc)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20700\x20THEN\x20\x27DELETE\x27'+_0x2bba5f(0xcb)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20702\x20THEN\x20\x27SmsAccounts\x27'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20710\x20THEN\x20\x27Realtime\x27'+_0x2bba5f(0xf2)+_0x2bba5f(0xce)+_0x2bba5f(0x163)+_0x2bba5f(0xbc)+_0x2bba5f(0x15b)+_0x2bba5f(0xad)+_0x2bba5f(0x12c)+_0x2bba5f(0x1a4)+_0x2bba5f(0xa0)+_0x2bba5f(0x1b2)+_0x2bba5f(0x7e)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201003\x20THEN\x20\x27CustomDashboards\x27'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201004\x20THEN\x20\x27Intervals\x27'+_0x2bba5f(0x198)+_0x2bba5f(0x86)+_0x2bba5f(0x13d)+_0x2bba5f(0x173)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201009\x20THEN\x20\x27Templates\x27'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201010\x20THEN\x20\x27Triggers\x27'+_0x2bba5f(0x1c0)+_0x2bba5f(0x174)+_0x2bba5f(0x1a1)+_0x2bba5f(0x6f)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201102\x20THEN\x20\x27SquareRecordings\x27'+_0x2bba5f(0x192)+_0x2bba5f(0x172)+_0x2bba5f(0x87)+_0x2bba5f(0x129)+_0x2bba5f(0x98)+_0x2bba5f(0x15f)+_0x2bba5f(0x17f)+_0x2bba5f(0xe8)+_0x2bba5f(0x79)+_0x2bba5f(0xa8)+_0x2bba5f(0x9c)+_0x2bba5f(0x1c2)+_0x2bba5f(0x14d)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201400\x20THEN\x20\x27Settings\x27'+_0x2bba5f(0x103)+_0x2bba5f(0xc6)+_0x2bba5f(0xf7)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201502\x20THEN\x20\x27IvrCampaigns\x27'+_0x2bba5f(0x145)+_0x2bba5f(0x183)+_0x2bba5f(0x82)+_0x2bba5f(0x123)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201701\x20THEN\x20\x27Projects\x27'+_0x2bba5f(0x184)+_0x2bba5f(0x12b)+_0x2bba5f(0x138)+_0x2bba5f(0x15e)+_0x2bba5f(0xfc)+'\x20\x20category\x20=\x20(SELECT'+_0x2bba5f(0x128)+'\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20100\x20THEN\x20\x27Dashboards\x27'+_0x2bba5f(0x180)+'\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(202,\x20203,\x20204)\x20THEN\x20\x27Staff\x27'+'\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(301,\x20302,\x20303,\x20304)\x20THEN\x20\x27ContactManager\x27'+_0x2bba5f(0x97)+_0x2bba5f(0x10e)+_0x2bba5f(0x8d)+'\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(701,\x20702,\x20710)\x20THEN\x20\x27Sms\x27'+_0x2bba5f(0xcd)+_0x2bba5f(0xcf)+_0x2bba5f(0xdf)+_0x2bba5f(0x167)+_0x2bba5f(0x19b)+'\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(1301,\x201302,\x201303,\x201305,\x201306,\x201307,\x201308)\x20THEN\x20\x27Integrations\x27'+_0x2bba5f(0xe2)+_0x2bba5f(0x17b)+'\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201600\x20THEN\x20\x27Help\x27'+_0x2bba5f(0x93)+'\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20between\x2088889\x20AND\x2099999\x20THEN\x20\x27AppZone\x27'+_0x2bba5f(0x11d)+'\x20\x20\x20\x20\x20\x20END'+_0x2bba5f(0x169)),_0x5482c7[_0x2bba5f(0x8c)]('DELETE\x20FROM\x20tmpSections'+_0x2bba5f(0x99)),_0x5482c7['query'](_0x2bba5f(0x106)+'\x20\x20('+_0x2bba5f(0xf5)+_0x2bba5f(0x146)+'\x20\x20\x20\x20sectionId\x20int(11)\x20not\x20null,'+_0x2bba5f(0x1b4)+_0x2bba5f(0x168)+_0x2bba5f(0x8f)+_0x2bba5f(0x88)+_0x2bba5f(0xf9)+'\x20\x20);'),_0x5482c7[_0x2bba5f(0x8c)]('INSERT\x20INTO\x20tmpCustomResources'+_0x2bba5f(0x101)+_0x2bba5f(0xf4)+_0x2bba5f(0xbd)),_0x5482c7[_0x2bba5f(0x8c)]('DELETE\x20t1\x20FROM\x20tmpSections\x20t1,\x20tmpCustomResources\x20t2'+_0x2bba5f(0xb6)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x118)+_0x2bba5f(0x1b8)),_0x5482c7[_0x2bba5f(0x8c)]('UPDATE\x20tmpSections'+'\x20\x20SET\x20sectionId\x20=\x201003\x20WHERE\x20sectionId\x20>=\x20100000;'),_0x5482c7[_0x2bba5f(0x8c)]('UPDATE\x20tmpSections'+_0x2bba5f(0x16d)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x6d)+_0x2bba5f(0xe0)+_0x2bba5f(0x115)+_0x2bba5f(0x71)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20name\x20=\x20\x27CustomDashboards\x27\x20THEN\x20(sectionId\x20-\x2099999)'+_0x2bba5f(0x109)+_0x2bba5f(0x1a0)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xca)+_0x2bba5f(0x1c5)+_0x2bba5f(0x116)),_0x5482c7[_0x2bba5f(0x8c)]('UPDATE\x20tmpSections\x20s'+_0x2bba5f(0x14a)+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20user_profile_has_sections\x20x'+_0x2bba5f(0x16b)),_0x5482c7[_0x2bba5f(0x8c)]('UPDATE\x20tmpCustomResources\x20r,\x20tmpSections\x20s'+'\x20\x20SET\x20r.sectionId\x20=\x20s.insertedId'+'\x20\x20WHERE\x20r.name\x20=\x20s.name\x20AND\x20r.userProfileId\x20=\x20s.userProfileId;'),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x1b0)+'\x20\x20('+_0x2bba5f(0x1b3)+_0x2bba5f(0x76)+_0x2bba5f(0x78)+_0x2bba5f(0x108)+_0x2bba5f(0x169)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x194)+'\x20\x20SELECT\x20cr.resourceId,\x20name,\x20s.insertedId,\x20s.sectionId'+_0x2bba5f(0x19c)+_0x2bba5f(0xf1)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x9f)+_0x2bba5f(0x1a6)+_0x2bba5f(0xf5)+_0x2bba5f(0x9a)+'\x20\x20\x20\x20type\x20varchar(255)\x20not\x20null,'+'\x20\x20\x20\x20insertedSectionId\x20int(11)\x20not\x20null,'+_0x2bba5f(0x195)+_0x2bba5f(0x169)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x1be)+_0x2bba5f(0x140)+_0x2bba5f(0x18e)+_0x2bba5f(0x13f)+'\x20\x20\x20\x20\x20\x20\x20\x20r.type\x20type,'+_0x2bba5f(0x154)+_0x2bba5f(0x10c)+_0x2bba5f(0x136)+_0x2bba5f(0x1b5)+_0x2bba5f(0xef)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x1be)+_0x2bba5f(0x159)+_0x2bba5f(0x15c)),_0x5482c7['query'](_0x2bba5f(0x196)+_0x2bba5f(0x10d)+_0x2bba5f(0x85)+_0x2bba5f(0xaf)+_0x2bba5f(0x80)+_0x2bba5f(0x12e)+_0x2bba5f(0x189)+_0x2bba5f(0xc3)+_0x2bba5f(0xd9)+_0x2bba5f(0xa6)+'\x20\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x20801\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20openchannel_queues\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)'+'\x20\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x20802\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20openchannel_accounts\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)'+_0x2bba5f(0x6e)+'\x20\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x20902\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20fax_accounts\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)'+_0x2bba5f(0xf3)+_0x2bba5f(0x122)+_0x2bba5f(0x148)+_0x2bba5f(0x126)+'\x20\x20END'+_0x2bba5f(0x142)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xd2)+'\x20\x20WHERE\x20name\x20=\x20\x27DELETE_MIGRATION\x27;'),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x17e)+_0x2bba5f(0x110)+'\x20\x20FROM\x20tmpNormalizedResources;'),_0x5482c7['query']('UPDATE\x20users\x20u,\x20tmpFinalProfiles\x20f'+_0x2bba5f(0x81)+_0x2bba5f(0x10b)),_0x5482c7[_0x2bba5f(0x8c)]('UPDATE\x20users\x20u'+_0x2bba5f(0xc1)+_0x2bba5f(0x18f)),_0x5482c7['query']('\x20DROP\x20TABLE\x20IF\x20EXISTS\x20tally;'),_0x5482c7['query'](_0x2bba5f(0x1a5)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x1bb)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x94)),_0x5482c7['query'](_0x2bba5f(0x1a8)),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0x95)),_0x5482c7[_0x2bba5f(0x8c)]('DROP\x20TABLE\x20IF\x20EXISTS\x20tmpSharedProfiles;'),_0x5482c7[_0x2bba5f(0x8c)]('DROP\x20TABLE\x20IF\x20EXISTS\x20tmpSingleProfiles;'),_0x5482c7[_0x2bba5f(0x8c)](_0x2bba5f(0xae)),_0x5482c7['query']('DROP\x20TABLE\x20IF\x20EXISTS\x20tmpSections;'),_0x5482c7[_0x2bba5f(0x8c)]('DROP\x20TABLE\x20IF\x20EXISTS\x20tmpCustomResources;'),_0x5482c7[_0x2bba5f(0x8c)]('DROP\x20TABLE\x20IF\x20EXISTS\x20tmpResources;'),_0x5482c7['query'](_0x2bba5f(0x1ad)),_0x5482c7['final'](_0x15be51);});},'down':function(){}};