01259cd3e5c8c38d8a40f5227726bf9331591ed5
[motion-next.git] / server / migrations / 2.1.0.js
1 const a964_0x1486=['\x20\x20WHERE\x20userId\x20IN\x20(SELECT\x20split.userId','migration','changeColumn','\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','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpGroupedPermissions;','\x20\x20SELECT\x20x.sectionId,\x20u.SquareProjectId,\x20x.userId','\x20\x20SELECT\x20\x27\x27,\x20insertedId,\x20name,\x20sectionId,\x20null','CREATE\x20TABLE\x20tmpResources','\x20\x20WHERE\x20x.sectionId\x20=\x20602;','CREATE\x20TABLE\x20tmpPermissions','\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\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','UPDATE\x20tmpCustomResources','\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','\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','UPDATE\x20tmpCustomResources\x20r,\x20tmpSections\x20s','\x20\x20KEY\x20`sectionId`\x20(`sectionId`),','catch','addColumn','\x20\x20FROM\x20tmpSections;','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(1301,\x201302,\x201303,\x201305,\x201306,\x201307,\x201308)\x20THEN\x20\x27Integrations\x27','\x20\x20GROUP\x20BY\x20userId;','addIndex','\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\x20WHERE\x20x.sectionId\x20=\x20601;','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20ELSE\x20\x27\x27','INSERT\x20INTO\x20tmpGroupedPermissions','INSERT\x20INTO\x20tmpNormalizedUsers','\x20\x20\x20\x20SUBSTRING_INDEX(SUBSTRING_INDEX(p.permissions,\x20\x27,\x27,\x20tally.n),\x20\x27,\x27,\x20-1)\x20permission,','\x20\x20SELECT\x20x.sectionId,\x20u.OpenchannelQueueId,\x20x.userId','\x20\x20CROSS\x20JOIN\x20(SELECT\x20@cnt\x20:=\x200)\x20as\x20dummy\x20LIMIT\x201)),\x20\x27red\x27,\x20now(),\x20now()','\x20\x20SELECT\x20GROUP_CONCAT(userId),\x20permissions,\x20null','\x20\x20FROM\x20tmpGroupedPermissions','\x20\x20\x20\x20userProfileId\x20int(11)\x20not\x20null,','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\x20\x20WHERE\x20POSITION(\x27,\x27\x20in\x20r.userIds)\x20>\x200','\x20\x20\x20\x20\x20\x20sectionId\x20int(11)','DELETE\x20t1\x20FROM\x20tmpSections\x20t1,\x20tmpCustomResources\x20t2','\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','CREATE\x20TABLE\x20tmpNormalizedResources','\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\x20\x20\x20\x20WHEN\x20sectionId\x20>=\x20100000\x20THEN\x20\x27CustomDashboards\x27',')\x20ENGINE=InnoDB\x20DEFAULT\x20CHARSET=utf8;','\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','\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\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\x20ORDER\x20BY\x20id;','\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)','tail','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201600\x20THEN\x20\x27Help\x27','UPDATE\x20users\x20u','\x20\x20INNER\x20JOIN\x20user_has_voice_queues\x20u\x20ON\x20u.UserId\x20=\x20x.userId','\x20\x20\x20\x20userId\x20text,','removeIndex','userProfileId','\x20\x20`userProfileId`\x20int(11)\x20DEFAULT\x20NULL,','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(601,\x20602,\x20603,\x20610)\x20THEN\x20\x27Mail\x27','\x20\x20`updatedAt`\x20datetime\x20NOT\x20NULL,','\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20tally','\x20\x20FROM\x20(SELECT','voice_voicemail','\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','INSERT\x20INTO\x20tmpNormalizedPermissions','\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','users','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpPermissions;','\x20\x20SELECT\x20x.sectionId,\x20u.ChatQueueId,\x20x.userId','\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=\x201009\x20THEN\x20\x27Templates\x27','\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)','finally','\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\x20FROM\x20tmpNormalizedResources;','\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','\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','\x20\x20WHERE\x20x.sectionId\x20=\x20902;','\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)','\x20\x20SELECT\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\x20ORDER\x20BY\x20users)\x20b','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(202,\x20203,\x20204)\x20THEN\x20\x27Staff\x27','\x20\x20WHERE\x20userProfileId\x20is\x20null\x20AND\x20role\x20=\x20\x27user\x27;','\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=\x20901\x20THEN\x20\x27FaxQueues\x27','\x20\x20\x20\x20\x20\x20END','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpResources;','INSERT\x20INTO\x20tmpSharedProfiles','sequence','\x20\x20SELECT\x20GROUP_CONCAT(sectionId\x20ORDER\x20BY\x20sectionId),\x20userId','\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\x20WHERE\x20x.sectionId\x20=\x20401\x20AND\x20q.type\x20=\x20\x27inbound\x27;','\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','dropTable','info','\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\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\x20INNER\x20JOIN\x20user_has_mail_queues\x20u\x20ON\x20u.UserId\x20=\x20x.userId','\x20\x20FROM\x20tmpCustomResources;','analytics_extracted_reports','\x20\x20\x20\x20p.userIds\x20userId','\x20\x20\x20\x20t.permissions\x20permissions','UPDATE\x20tmpSections','\x20\x20\x20\x20\x20\x20\x20\x20r.insertedSectionId\x20insertedSectionId,','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(1201,\x201202,\x201203)\x20THEN\x20\x27Analytics\x27','\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\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\x20\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=\x20710\x20THEN\x20\x27Realtime\x27','\x20\x20SET\x20profileId\x20=\x20(SELECT\x20(@cnt\x20:=\x20@cnt\x20+\x201)\x20AS\x20rowNumber','\x20\x20SET\x20sectionId\x20=\x201801\x20WHERE\x20sectionId\x20between\x2088889\x20AND\x2099999;','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20>=\x20100000\x20THEN\x20\x27Tools\x27','\x20\x20WHERE\x20x.sectionId\x20=\x20501;','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(301,\x20302,\x20303,\x20304)\x20THEN\x20\x27ContactManager\x27','\x20\x20WHERE\x20u.id\x20=\x20t.userId;','renameColumn','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpFinalProfiles;','\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','Removed\x20column\x20%s\x20from\x20%s','\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','\x20\x20SELECT\x20x.sectionId,\x20u.VoiceQueueId,\x20x.userId','\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\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','DELETE\x20FROM\x20tmpSections','\x20\x20sectionId\x20int(11)\x20not\x20null,','\x20\x20\x20\x20\x20\x20\x20\x20r.type\x20type,','prototype','\x20\x20UNIQUE\x20KEY\x20`name`\x20(`name`)','\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','\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\x20UNION','\x20\x20INNER\x20JOIN\x20user_has_sms_queues\x20u\x20ON\x20u.UserId\x20=\x20x.userId','\x20\x20\x20\x20\x20\x20userId\x20text\x20not\x20null,','\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\x20role\x20=\x20\x27user\x27\x20and\x20permissions\x20is\x20not\x20null\x20and\x20permissions\x20<>\x20\x27\x27','final','\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','CREATE\x20TABLE\x20tmpExtractedResources\x20(','\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','join','\x20\x20);','\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','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpNormalizedResources;','\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\x20\x20resourceId\x20text','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20);','INSERT\x20INTO\x20tmpFinalProfiles','\x20\x20\x20\x20SUBSTRING_INDEX(SUBSTRING_INDEX(t.userIds,\x20\x27,\x27,\x20tally.n),\x20\x27,\x27,\x20-1)\x20userId,','\x20\x20\x20\x20autoAssociation\x20tinyint\x20not\x20null,','\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\x20SELECT\x20x.sectionId,\x20u.ChatWebsiteId,\x20x.userId','INSERT\x20INTO\x20tally\x20(n)','\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','FOREIGN\x20KEY\x20(`userProfileId`)\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','stringify','\x20\x20KEY\x20`compositeIndex`\x20(`sectionId`,`userProfileId`),','UPDATE\x20users\x20u,\x20tmpNormalizedPermissions\x20t','\x20\x20WHERE\x20r.name\x20=\x20s.name\x20AND\x20r.userProfileId\x20=\x20s.userProfileId;','\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)','\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\x20WHERE\x20x.sectionId\x20=\x20802;','\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','\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20CASE','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201701\x20THEN\x20\x27jscripty\x27','\x20\x20ORDER\x20BY\x20GROUP_CONCAT(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\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','INSERT\x20INTO\x20user_profiles\x20(name,\x20crudPermissions,\x20createdAt,\x20updatedAt)','CREATE\x20TABLE\x20tally\x20(','\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','\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\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=\x20304\x20THEN\x20\x27GlobalCustomFields\x27','\x20\x20INNER\x20JOIN\x20user_has_fax_queues\x20u\x20ON\x20u.UserId\x20=\x20x.userId','VALUES\x20(\x27Default\x27,\x20\x27red\x27,\x20NULL,\x20NOW(),\x20NOW());','\x20\x20SELECT\x20x.sectionId,\x20u.SmsQueueId,\x20x.userId','\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','INSERT\x20INTO\x20tmpExtractedResources','\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\x20name\x20=\x20\x27DELETE\x27;','\x20\x20\x20\x20userId\x20int(11)\x20not\x20null','\x20\x20SELECT\x20GROUP_CONCAT(id),\x20permissions,\x20null','\x20\x20WHERE\x20t1.name\x20=\x20t2.name\x20AND\x20t1.userProfileId\x20=\x20t2.userProfileId\x20AND\x20t1.sectionId\x20>\x20t2.sectionId;','Renamed\x20column\x20from\x20%s\x20to\x20%s\x20on\x20%s','UPDATE\x20tmpFinalProfiles','\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)','\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(SELECT\x20GROUP_CONCAT(userId\x20ORDER\x20BY\x20userId\x20ASC)\x20as\x20users','\x20\x20\x20\x20\x20\x20type\x20varchar(255)\x20not\x20null,','ON\x20UPDATE\x20CASCADE','\x20\x20\x20\x20type\x20varchar(255)\x20not\x20null,','\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','removeIndex\x20%s\x20%s','\x20\x20`crudPermissions`\x20varchar(255)\x20NOT\x20NULL\x20DEFAULT\x20\x27r\x27,','\x20\x20SELECT\x20cr.resourceId,\x20name,\x20s.insertedId,\x20s.sectionId','inspect','\x20\x20SELECT\x20id,\x20permissions,\x20null','DELETE\x20FROM\x20tmpNormalizedResources','INSERT\x20INTO\x20tmpResources','\x20\x20FROM\x20user_profiles\x20u','then','\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20n)\x20AS\x20split;','\x20\x20SET\x20r.sectionId\x20=\x20s.insertedId','\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\x20r.sectionId\x20sectionId','\x20\x20\x20\x20\x20\x20permissions\x20text\x20not\x20null,','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=\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=\x201307\x20THEN\x20\x27ZohoAccounts\x27','\x20\x20WHERE\x20x.sectionId\x20=\x201501\x20AND\x20q.type\x20=\x20\x27outbound\x27;','\x20\x20(','\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\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\x20fp.profileId\x20profileId,','\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\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',',(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','\x20\x20INNER\x20JOIN\x20user_has_openchannel_accounts\x20u\x20ON\x20u.UserId\x20=\x20x.userId','INSERT\x20INTO\x20tmpNormalizedResources','\x20\x20SELECT\x20x.sectionId,\x20u.SmsAccountId,\x20x.userId','\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\x20WHERE\x20x.sectionId\x20=\x20901;','\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\x20\x20\x20\x20\x20\x20\x20ELSE\x20\x27\x27','\x20\x20\x20\x20\x20\x20WHEN\x20name\x20=\x20\x27Plugins\x27\x20THEN\x20(sectionId\x20-\x2088888)','INSERT\x20INTO\x20user_profile_has_resources\x20(name,\x20resourceId,\x20type,\x20createdAt,\x20updatedAt,\x20sectionId)','\x20\x20ORDER\x20BY\x20n)\x20AS\x20split;','\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\x20INNER\x20JOIN\x20user_has_mail_accounts\x20u\x20ON\x20u.UserId\x20=\x20x.userId','\x20\x20\x20\x20\x20\x20resourceId\x20text,','\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\x20\x20\x20category\x20varchar(255)\x20not\x20null,','\x20\x20FROM\x20tmpFinalProfiles\x20t','CREATE\x20TABLE\x20tmpGroupedPermissions','CREATE\x20TABLE\x20tmpNormalizedUsers','\x20\x20\x20\x20\x20\x20permissions\x20text\x20not\x20null','CREATE\x20TABLE\x20tmpFinalProfiles','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(1501,\x201502,\x201510)\x20THEN\x20\x27MotionDialer\x27','ADD\x20CONSTRAINT\x20`users_ibfk_1`\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(SELECT\x20GROUP_CONCAT(userId\x20ORDER\x20BY\x20userId\x20ASC)\x20AS\x20users','enqueue','\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\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20(SELECT','\x20\x20WHERE\x20x.sectionId\x20=\x20702;','\x20\x20\x20\x20enabled\x20tinyint\x20not\x20null,','SELECT\x20NULL\x20FROM','\x20\x20GROUP\x20BY\x20permissions','\x20\x20SET\x20insertedId\x20=\x20(SELECT','reportType','\x20\x20FROM\x20tmpNormalizedUsers\x20x','\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','\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','\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','\x20\x20SELECT\x20CONCAT(\x27Profile_\x27,\x20(SELECT\x20(@cnt\x20:=\x20@cnt\x20+\x201)\x20AS\x20rowNumber','Changed\x20column\x20%s\x20in\x20table\x20%s','\x20\x20`sectionId`\x20int(11)\x20DEFAULT\x20NULL,','\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\x20SELECT\x20x.sectionId,\x20u.FaxAccountId,\x20x.userId','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(701,\x20702,\x20710)\x20THEN\x20\x27Sms\x27','\x20\x20FROM\x20tmpNormalizedSections','\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','\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\x20SUBSTRING_INDEX(SUBSTRING_INDEX(fp.permissions,\x20\x27,\x27,\x20tally.n),\x20\x27,\x27,\x20-1)\x20permission,','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpCustomResources;','removeColumn','\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\x20WHEN\x20sectionId\x20=\x201006\x20THEN\x20\x27Scheduler\x27','CREATE\x20TABLE\x20tmpCustomResources','addIndex\x20%s\x20%s\x20%s','CREATE\x20TABLE\x20tmpNormalizedPermissions','CREATE\x20TABLE\x20`user_profiles`\x20(','\x20\x20INNER\x20JOIN\x20user_has_square_projects\x20u\x20ON\x20u.UserId\x20=\x20x.userId','\x20\x20SET\x20name\x20=\x20(SELECT','\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','UPDATE\x20users\x20u,\x20tmpFinalProfiles\x20f','\x20\x20INNER\x20JOIN\x20user_has_fax_accounts\x20u\x20ON\x20u.UserId\x20=\x20x.userId','query','\x20\x20\x20\x20userId\x20text','\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\x20SET','\x20\x20`name`\x20varchar(255)\x20NOT\x20NULL,','../config/logger','\x20\x20END','\x20\x20resourceId\x20int(11),','INSERT\x20INTO\x20tmpCustomResources','\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;',',(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','INSERT\x20INTO\x20tmpNormalizedSections','\x20\x20FROM\x20tmpFinalProfiles;','\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','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20100\x20THEN\x20\x27Dashboards\x27','\x20\x20`id`\x20int(11)\x20NOT\x20NULL\x20AUTO_INCREMENT,','CREATE\x20TABLE\x20`user_profile_has_sections`\x20(','\x20\x20\x20\x20\x20\x20name\x20=\x20(SELECT','\x20\x20KEY\x20`userProfileId`\x20(`userProfileId`),','UPDATE\x20tmpSections\x20s','\x20\x20userId\x20int(11)','name','Added\x20column\x20%s\x20to\x20%s','\x20\x20\x20\x20sectionId\x20int(11)','\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','CREATE\x20TABLE\x20tmpSharedProfiles','\x20\x20WHERE\x20userId\x20NOT\x20IN\x20(SELECT\x20split.userId','\x20\x20WHERE\x20x.sectionId\x20=\x20502;','query\x20%s','ALTER\x20TABLE\x20`users`\x20','\x20\x20SET\x20u.userProfileId\x20=\x201','\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\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(501,\x20502,\x20510)\x20THEN\x20\x27Chat\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)\x20a','INSERT\x20INTO\x20tmpPermissions','util','\x20\x20CROSS\x20JOIN\x20(SELECT\x20@cnt\x20:=\x201)\x20as\x20dummy\x20LIMIT\x201)','DROP\x20TABLE\x20IF\x20EXISTS\x20tmpSections;','\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\x20INNER\x20JOIN\x20voice_queues\x20q\x20ON\x20u.VoiceQueueId\x20=\x20q.id','\x20\x20PRIMARY\x20KEY\x20(`id`),','sequelize','\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\x20INNER\x20JOIN\x20user_has_chat_queues\x20u\x20ON\x20u.UserId\x20=\x20x.userId','exports','\x20\x20`createdAt`\x20datetime\x20NOT\x20NULL,','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20in\x20(1101,\x201102,\x201103)\x20THEN\x20\x27CallySquare\x27','\x20\x20FROM\x20tmpSections\x20s','INTEGER','\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','\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\x20`crudPermissions`\x20varchar(255)\x20DEFAULT\x20NULL,','\x20\x20n\x20INT\x20NOT\x20NULL\x20AUTO_INCREMENT\x20PRIMARY\x20KEY','\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\x20WHERE\x20name\x20=\x20\x27DELETE_MIGRATION\x27;','\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20between\x2088889\x20AND\x2099999\x20THEN\x20\x27AppZone\x27','\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',',(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`type`\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=\x20910\x20THEN\x20\x27Realtime\x27','queryInterface','\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\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\x20\x20\x20sectionId\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=\x20300\x20THEN\x20\x27DELETE\x27','\x20\x20\x20\x20\x20\x20profileId\x20int(11)'];(function(_0x58fa1e,_0x1486f2){const _0x16eda0=function(_0x2ed34a){while(--_0x2ed34a){_0x58fa1e['push'](_0x58fa1e['shift']());}};_0x16eda0(++_0x1486f2);}(a964_0x1486,0xd2));const a964_0x16ed=function(_0x58fa1e,_0x1486f2){_0x58fa1e=_0x58fa1e-0x0;let _0x16eda0=a964_0x1486[_0x58fa1e];return _0x16eda0;};const _0x3c5ce2=a964_0x16ed;'use strict';const util=require(_0x3c5ce2('0x66')),logger=require(_0x3c5ce2('0x47'))(_0x3c5ce2('0x86')),Sequence=function(){};Sequence['prototype'][_0x3c5ce2('0x1d')]=function(_0x2ed34a){const _0x4fa1a0=_0x3c5ce2;this[_0x4fa1a0('0xb5')]=this[_0x4fa1a0('0xb5')]?this['tail'][_0x4fa1a0('0xcb')](_0x2ed34a):_0x2ed34a();};const Migration=function(_0x5badba){const _0x5d0609=_0x3c5ce2;this[_0x5d0609('0x7f')]=_0x5badba,this[_0x5d0609('0xdb')]=new Sequence();};Migration['prototype'][_0x3c5ce2('0x87')]=function(_0x40bdc9,_0x514702,_0x350775){const _0x447ee0=_0x3c5ce2,_0x24fa08=this;this['sequence'][_0x447ee0('0x1d')](function(){const _0x1bf508=_0x447ee0;return _0x24fa08[_0x1bf508('0x7f')][_0x1bf508('0x87')](_0x40bdc9,_0x514702,_0x350775)['then'](function(){const _0x5d8aaa=_0x1bf508;logger[_0x5d8aaa('0xe1')](_0x5d8aaa('0x2b'),_0x514702,_0x40bdc9);})['catch'](function(_0x3a78a2){const _0xa56bd5=_0x1bf508;logger[_0xa56bd5('0xe1')](JSON[_0xa56bd5('0x11e')](_0x3a78a2));});});},Migration[_0x3c5ce2('0x101')][_0x3c5ce2('0x97')]=function(_0x11157b,_0x130922,_0x3f2235){const _0xf97856=_0x3c5ce2,_0x4090fa=this;this[_0xf97856('0xdb')]['enqueue'](function(){const _0x489929=_0xf97856;return _0x4090fa['queryInterface'][_0x489929('0x97')](_0x11157b,_0x130922,_0x3f2235)[_0x489929('0x14b')](function(){const _0x97b799=_0x489929;logger[_0x97b799('0xe1')](_0x97b799('0x59'),_0x130922,_0x11157b);})['catch'](function(_0x37e92f){const _0x55a6d1=_0x489929;logger[_0x55a6d1('0xe1')](JSON[_0x55a6d1('0x11e')](_0x37e92f));});});},Migration[_0x3c5ce2('0x101')][_0x3c5ce2('0xe0')]=function(_0x3ab5de){const _0x5bc820=_0x3c5ce2,_0xd4ba4b=this;this[_0x5bc820('0xdb')][_0x5bc820('0x1d')](function(){const _0x5f382d=_0x5bc820;return _0xd4ba4b[_0x5f382d('0x7f')][_0x5f382d('0xe0')](_0x3ab5de,{'force':!![]})[_0x5f382d('0x14b')](function(){const _0x4807be=_0x5f382d;logger[_0x4807be('0xe1')]('table\x20dropped\x20%s',_0x3ab5de);})[_0x5f382d('0x96')](function(_0x2722e6){const _0x2f39af=_0x5f382d;logger[_0x2f39af('0xe1')](JSON[_0x2f39af('0x11e')](_0x2722e6));});});},Migration['prototype'][_0x3c5ce2('0x9b')]=function(_0xb930ee,_0x3c4aeb,_0x71eef1){const _0x583611=_0x3c5ce2,_0x1096c4=this;this[_0x583611('0xdb')][_0x583611('0x1d')](function(){const _0xfac932=_0x583611;return _0x1096c4['queryInterface']['addIndex'](_0xb930ee,_0x3c4aeb,{'indexName':_0x71eef1})[_0xfac932('0x14b')](function(){const _0x3a815d=_0xfac932;logger[_0x3a815d('0xe1')](_0x3a815d('0x3a'),_0xb930ee,_0x3c4aeb[_0x3a815d('0x10e')](','),_0x71eef1);})[_0xfac932('0x96')](function(_0x33d71a){const _0x176251=_0xfac932;logger['info'](JSON[_0x176251('0x11e')](_0x33d71a));});});},Migration[_0x3c5ce2('0x101')][_0x3c5ce2('0xba')]=function(_0x2d6811,_0x16d486){const _0x298e1a=_0x3c5ce2,_0x5ac3fc=this;this['sequence'][_0x298e1a('0x1d')](function(){const _0x50e335=_0x298e1a;return _0x5ac3fc['queryInterface'][_0x50e335('0xba')](_0x2d6811,_0x16d486)[_0x50e335('0x14b')](function(){const _0x1b9721=_0x50e335;logger[_0x1b9721('0xe1')](_0x1b9721('0x143'),_0x2d6811,_0x16d486);})[_0x50e335('0x96')](function(_0x5db799){const _0xfc7fc0=_0x50e335;logger[_0xfc7fc0('0xe1')](JSON['stringify'](_0x5db799));});});},Migration[_0x3c5ce2('0x101')]['query']=function(_0x1d565d){const _0x1d61f4=_0x3c5ce2,_0x4de22a=this;this[_0x1d61f4('0xdb')][_0x1d61f4('0x1d')](function(){const _0x450a5e=_0x1d61f4;return _0x4de22a['queryInterface'][_0x450a5e('0x6c')][_0x450a5e('0x42')](_0x1d565d)[_0x450a5e('0x14b')](function(){const _0x5a52c9=_0x450a5e;logger['info'](_0x5a52c9('0x5f'),_0x1d565d);})[_0x450a5e('0x96')](function(_0x414ab6){const _0x28d551=_0x450a5e;logger[_0x28d551('0xe1')](JSON['stringify'](_0x414ab6));});});},Migration['prototype']['removeColumn']=function(_0x441d0b,_0x32c27a){const _0x4bb882=_0x3c5ce2,_0x228c84=this;this[_0x4bb882('0xdb')][_0x4bb882('0x1d')](function(){const _0x2f47b=_0x4bb882;return _0x228c84[_0x2f47b('0x7f')][_0x2f47b('0x36')](_0x441d0b,_0x32c27a)[_0x2f47b('0x14b')](function(){const _0xb9cfcf=_0x2f47b;logger[_0xb9cfcf('0xe1')](_0xb9cfcf('0xf9'),_0x32c27a,_0x441d0b);})[_0x2f47b('0x96')](function(_0x39eaa7){const _0xb0d680=_0x2f47b;logger[_0xb0d680('0xe1')](util['inspect'](_0x39eaa7,{'showHidden':![],'depth':null}));});});},Migration[_0x3c5ce2('0x101')][_0x3c5ce2('0xf6')]=function(_0x3411b6,_0x411a03,_0x3119f3){const _0x551ef8=_0x3c5ce2,_0x4d4aa4=this;this[_0x551ef8('0xdb')][_0x551ef8('0x1d')](function(){const _0x22cb9b=_0x551ef8;return _0x4d4aa4[_0x22cb9b('0x7f')][_0x22cb9b('0xf6')](_0x3411b6,_0x411a03,_0x3119f3)['then'](function(){const _0x282522=_0x22cb9b;logger[_0x282522('0xe1')](_0x282522('0x13a'),_0x411a03,_0x3119f3,_0x3411b6);})[_0x22cb9b('0x96')](function(_0x26f867){const _0x1c3b5d=_0x22cb9b;logger[_0x1c3b5d('0xe1')](util[_0x1c3b5d('0x146')](_0x26f867,{'showHidden':![],'depth':null}));});});},Migration[_0x3c5ce2('0x101')][_0x3c5ce2('0x10a')]=function(_0x4fa8ad){const _0x290bf9=_0x3c5ce2;this[_0x290bf9('0xdb')]['enqueue'](function(){return _0x4fa8ad();});},module[_0x3c5ce2('0x6f')]={'up':function(_0x2dc412,_0x52a1af){return new Promise(function(_0x2ba63d){const _0x10ea21=a964_0x16ed,_0x144f7b=new Migration(_0x2dc412);_0x144f7b['addColumn'](_0x10ea21('0xe6'),'reportId',{'type':_0x52a1af['INTEGER']}),_0x144f7b[_0x10ea21('0x97')](_0x10ea21('0xe6'),_0x10ea21('0x25'),{'type':_0x52a1af['STRING']}),_0x144f7b[_0x10ea21('0x97')](_0x10ea21('0xc5'),_0x10ea21('0xbb'),{'type':_0x52a1af[_0x10ea21('0x73')]}),_0x144f7b[_0x10ea21('0x36')](_0x10ea21('0xc1'),_0x10ea21('0x58')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x3c')+_0x10ea21('0x52')+'\x20\x20`name`\x20varchar(255)\x20NOT\x20NULL,'+_0x10ea21('0x144')+'\x20\x20`description`\x20varchar(255)\x20DEFAULT\x20NULL,'+_0x10ea21('0x70')+'\x20\x20`updatedAt`\x20datetime\x20NOT\x20NULL,'+_0x10ea21('0x6b')+_0x10ea21('0x102')+_0x10ea21('0xaf')),_0x144f7b[_0x10ea21('0x42')]('INSERT\x20INTO\x20`user_profiles`\x20(`name`,\x20`crudPermissions`,\x20`description`,\x20`createdAt`,\x20`updatedAt`)'+_0x10ea21('0x131')),_0x144f7b['query'](_0x10ea21('0x60')+_0x10ea21('0x1b')+_0x10ea21('0x11c')+'REFERENCES\x20user_profiles(`id`)\x20'+_0x10ea21('0x140')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x53')+_0x10ea21('0x52')+_0x10ea21('0x46')+'\x20\x20`category`\x20varchar(255)\x20NOT\x20NULL,'+'\x20\x20`sectionId`\x20int(11)\x20NOT\x20NULL,'+_0x10ea21('0x37')+'\x20\x20`autoAssociation`\x20tinyint(1)\x20DEFAULT\x20NULL,'+_0x10ea21('0x76')+'\x20\x20`createdAt`\x20datetime\x20NOT\x20NULL,'+_0x10ea21('0xbe')+_0x10ea21('0xbc')+_0x10ea21('0x6b')+_0x10ea21('0x55')+_0x10ea21('0x11f')+_0x10ea21('0x13')+')\x20ENGINE=InnoDB\x20DEFAULT\x20CHARSET=utf8;'),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0xa7')+_0x10ea21('0x52')+_0x10ea21('0x46')+'\x20\x20`resourceId`\x20int(11)\x20NOT\x20NULL,'+_0x10ea21('0x7d')+_0x10ea21('0x70')+_0x10ea21('0xbe')+_0x10ea21('0x2c')+_0x10ea21('0x6b')+_0x10ea21('0x95')+'\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'+_0x10ea21('0xaf')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x12b')+_0x10ea21('0x77')+');'),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x11a')+_0x10ea21('0x22')+_0x10ea21('0x64')+',(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'+_0x10ea21('0x4d')+_0x10ea21('0x4')+_0x10ea21('0x7c')+';'),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x8e')+'\x20\x20('+'\x20\x20\x20\x20\x20\x20userIds\x20varchar(255)\x20not\x20null,'+_0x10ea21('0x150')+_0x10ea21('0x84')+_0x10ea21('0x10f')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x65')+_0x10ea21('0x147')+'\x20\x20FROM\x20users'+_0x10ea21('0x109')+_0x10ea21('0xb3')),_0x144f7b[_0x10ea21('0x42')]('CREATE\x20TABLE\x20tmpNormalizedSections'+_0x10ea21('0x155')+_0x10ea21('0x82')+_0x10ea21('0xb9')+_0x10ea21('0x113')+_0x10ea21('0x10f')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x4e')+'\x20\x20SELECT\x20DISTINCT\x20permission,\x20userId,\x200'+_0x10ea21('0xc0')+_0x10ea21('0xa1')+_0x10ea21('0xe7')+'\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'+_0x10ea21('0xf')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x3b')+_0x10ea21('0x155')+'\x20\x20\x20\x20permissions\x20text\x20not\x20null,'+_0x10ea21('0x137')+_0x10ea21('0x10f')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0xc3')+_0x10ea21('0xdc')+_0x10ea21('0x30')+_0x10ea21('0x9a')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x120')+'\x20\x20SET\x20u.permissions\x20=\x20t.permissions'+_0x10ea21('0xf5')),_0x144f7b[_0x10ea21('0x42')]('TRUNCATE\x20TABLE\x20tmpPermissions;'),_0x144f7b['query'](_0x10ea21('0x65')+_0x10ea21('0x138')+'\x20\x20FROM\x20users'+'\x20\x20WHERE\x20role\x20=\x20\x27user\x27\x20and\x20permissions\x20is\x20not\x20null\x20and\x20permissions\x20<>\x20\x27\x27'+_0x10ea21('0x23')+'\x20\x20ORDER\x20BY\x20GROUP_CONCAT(id);'),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x17')+_0x10ea21('0x155')+_0x10ea21('0x82')+'\x20\x20\x20\x20userId\x20text,'+_0x10ea21('0x113')+_0x10ea21('0x10f')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0xa0')+'\x20\x20SELECT\x20permission,\x20userId,\x200'+_0x10ea21('0xc0')+'\x20\x20s.sectionId\x20permission,'+'\x20\x20\x20\x20\x20\x20SUBSTRING_INDEX(SUBSTRING_INDEX(s.userId,\x20\x27,\x27,\x20t.n),\x20\x27,\x27,\x20-1)\x20userId'+_0x10ea21('0x3f')+_0x10ea21('0xf')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x10c')+_0x10ea21('0xff')+_0x10ea21('0x49')+_0x10ea21('0x57')+'\x20\x20);'),_0x144f7b['query'](_0x10ea21('0x134')+_0x10ea21('0xfb')+_0x10ea21('0x26')+'\x20\x20INNER\x20JOIN\x20user_has_voice_queues\x20u\x20ON\x20u.UserId\x20=\x20x.userId'+_0x10ea21('0x6a')+_0x10ea21('0xde')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x134')+_0x10ea21('0xc7')+_0x10ea21('0x26')+_0x10ea21('0x6e')+_0x10ea21('0xf3')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x134')+_0x10ea21('0x119')+_0x10ea21('0x26')+'\x20\x20INNER\x20JOIN\x20user_has_chat_websites\x20u\x20ON\x20u.UserId\x20=\x20x.userId'+_0x10ea21('0x5e')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x134')+'\x20\x20SELECT\x20x.sectionId,\x20u.MailQueueId,\x20x.userId'+_0x10ea21('0x26')+_0x10ea21('0xe4')+_0x10ea21('0x9d')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x134')+_0x10ea21('0xc8')+'\x20\x20FROM\x20tmpNormalizedUsers\x20x'+_0x10ea21('0x11')+_0x10ea21('0x8d')),_0x144f7b[_0x10ea21('0x42')]('INSERT\x20INTO\x20tmpExtractedResources'+_0x10ea21('0x132')+_0x10ea21('0x26')+_0x10ea21('0x106')+'\x20\x20WHERE\x20x.sectionId\x20=\x20701;'),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x134')+_0x10ea21('0x7')+'\x20\x20FROM\x20tmpNormalizedUsers\x20x'+'\x20\x20INNER\x20JOIN\x20user_has_sms_accounts\x20u\x20ON\x20u.UserId\x20=\x20x.userId'+_0x10ea21('0x20')),_0x144f7b[_0x10ea21('0x42')]('INSERT\x20INTO\x20tmpExtractedResources'+_0x10ea21('0xa2')+_0x10ea21('0x26')+'\x20\x20INNER\x20JOIN\x20user_has_openchannel_queues\x20u\x20ON\x20u.UserId\x20=\x20x.userId'+_0x10ea21('0x4c')),_0x144f7b['query'](_0x10ea21('0x134')+'\x20\x20SELECT\x20x.sectionId,\x20u.OpenchannelAccountId,\x20x.userId'+_0x10ea21('0x26')+_0x10ea21('0x5')+_0x10ea21('0x124')),_0x144f7b[_0x10ea21('0x42')]('INSERT\x20INTO\x20tmpExtractedResources'+'\x20\x20SELECT\x20x.sectionId,\x20u.FaxQueueId,\x20x.userId'+_0x10ea21('0x26')+_0x10ea21('0x130')+_0x10ea21('0xa')),_0x144f7b[_0x10ea21('0x42')]('INSERT\x20INTO\x20tmpExtractedResources'+_0x10ea21('0x2e')+'\x20\x20FROM\x20tmpNormalizedUsers\x20x'+_0x10ea21('0x41')+_0x10ea21('0xd0')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x134')+_0x10ea21('0x8a')+_0x10ea21('0x26')+_0x10ea21('0x3d')+'\x20\x20WHERE\x20x.sectionId\x20=\x201103;'),_0x144f7b[_0x10ea21('0x42')]('INSERT\x20INTO\x20tmpExtractedResources'+'\x20\x20SELECT\x20x.sectionId,\x20u.VoiceQueueId,\x20x.userId'+_0x10ea21('0x26')+_0x10ea21('0xb8')+_0x10ea21('0x6a')+_0x10ea21('0x154')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x16')+_0x10ea21('0x155')+_0x10ea21('0x107')+_0x10ea21('0x18')+_0x10ea21('0x10f')),_0x144f7b['query'](_0x10ea21('0x9f')+'\x20\x20SELECT\x20userId,\x20permissions'+_0x10ea21('0xc0')+_0x10ea21('0x116')+_0x10ea21('0xe8')+_0x10ea21('0x90')+_0x10ea21('0xf')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x5c')+_0x10ea21('0x155')+'\x20\x20\x20\x20\x20\x20userIds\x20varchar(255)\x20not\x20null,'+'\x20\x20\x20\x20\x20\x20permissions\x20text\x20not\x20null,'+_0x10ea21('0x84')+_0x10ea21('0x10f')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0xda')+_0x10ea21('0xa4')+_0x10ea21('0xa5')+_0x10ea21('0x5d')+_0x10ea21('0x1f')+_0x10ea21('0xe3')+'\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'+_0x10ea21('0x129')+_0x10ea21('0xed')+_0x10ea21('0x135')+'\x20\x20WHERE\x20split.userId\x20IN\x20(SELECT\x20*\x20FROM'+_0x10ea21('0x1c')+_0x10ea21('0x78')+'\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'+_0x10ea21('0x80')+'\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))'+_0x10ea21('0x23')+_0x10ea21('0x128')),_0x144f7b[_0x10ea21('0x42')]('CREATE\x20TABLE\x20tmpSingleProfiles'+'\x20\x20('+_0x10ea21('0x107')+_0x10ea21('0x150')+_0x10ea21('0x84')+_0x10ea21('0x10f')),_0x144f7b[_0x10ea21('0x42')]('INSERT\x20INTO\x20tmpSingleProfiles'+'\x20\x20SELECT\x20userId,\x20permissions,\x20null'+_0x10ea21('0xa5')+_0x10ea21('0x85')+_0x10ea21('0x69')+_0x10ea21('0x142')+_0x10ea21('0xa8')+_0x10ea21('0x11d')+'\x20\x20WHERE\x20split.userId\x20IN\x20(SELECT\x20*\x20FROM'+_0x10ea21('0x13e')+'\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'+_0x10ea21('0xdd')+_0x10ea21('0xd3')+_0x10ea21('0x44')+'\x20\x20ORDER\x20BY\x20userId;'),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x19')+'\x20\x20('+_0x10ea21('0x107')+_0x10ea21('0x150')+_0x10ea21('0x84')+_0x10ea21('0x10f')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x115')+'\x20\x20SELECT\x20*\x20FROM\x20tmpSharedProfiles'+_0x10ea21('0x105')+'\x20\x20SELECT\x20*\x20FROM\x20tmpSingleProfiles;'),_0x144f7b['query'](_0x10ea21('0x12a')+_0x10ea21('0x2a')+_0x10ea21('0x15')+_0x10ea21('0xa3')+_0x10ea21('0x4f')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x13b')+_0x10ea21('0xf0')+_0x10ea21('0x14a')+_0x10ea21('0x67')),_0x144f7b[_0x10ea21('0x42')]('CREATE\x20TABLE\x20tmpSections'+_0x10ea21('0x155')+_0x10ea21('0x13d')+'\x20\x20\x20\x20category\x20varchar(255)\x20not\x20null,'+_0x10ea21('0x82')+_0x10ea21('0x21')+'\x20\x20\x20\x20autoAssociation\x20tinyint\x20not\x20null,'+_0x10ea21('0xa6')+'\x20\x20\x20\x20insertedId\x20int(11),'+_0x10ea21('0x43')+_0x10ea21('0x10f')),_0x144f7b[_0x10ea21('0x42')]('INSERT\x20INTO\x20tmpSections'+'\x20\x20SELECT\x20\x27\x27,\x20\x27\x27,\x20permission,\x201,\x200,\x20profileId,\x20null,\x20userId'+_0x10ea21('0xc0')+_0x10ea21('0x1')+_0x10ea21('0x34')+'\x20\x20\x20\x20\x20\x20\x20\x20SUBSTRING_INDEX(fp.userId,\x20\x27,\x27,\x201)\x20userId'+_0x10ea21('0xbf')+'\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'+_0x10ea21('0x14c')),_0x144f7b[_0x10ea21('0x42')]('UPDATE\x20tmpSections'+_0x10ea21('0x45')+_0x10ea21('0x54')+_0x10ea21('0x126')+_0x10ea21('0xce')+_0x10ea21('0xad')+'\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\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'+_0x10ea21('0x118')+_0x10ea21('0xc2')+'\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'+_0x10ea21('0x83')+_0x10ea21('0x92')+_0x10ea21('0x7b')+_0x10ea21('0x103')+_0x10ea21('0x12f')+'\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'+_0x10ea21('0x133')+_0x10ea21('0x31')+_0x10ea21('0x28')+'\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'+'\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'+_0x10ea21('0xcf')+'\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'+_0x10ea21('0x2d')+_0x10ea21('0x27')+_0x10ea21('0x11b')+_0x10ea21('0xec')+_0x10ea21('0x50')+_0x10ea21('0x110')+_0x10ea21('0x112')+'\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=\x20600\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=\x20601\x20THEN\x20\x27MailQueues\x27'+_0x10ea21('0x10d')+_0x10ea21('0x3')+'\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\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x20700\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=\x20701\x20THEN\x20\x27SmsQueues\x27'+_0x10ea21('0x152')+_0x10ea21('0xef')+_0x10ea21('0x6d')+_0x10ea21('0x9c')+_0x10ea21('0x62')+_0x10ea21('0xb1')+'\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'+_0x10ea21('0xd7')+_0x10ea21('0x4b')+_0x10ea21('0x7e')+_0x10ea21('0x93')+_0x10ea21('0x8f')+_0x10ea21('0x104')+_0x10ea21('0xdf')+_0x10ea21('0xab')+'\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'+_0x10ea21('0x38')+'\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'+_0x10ea21('0xf8')+_0x10ea21('0xc9')+_0x10ea21('0xfd')+_0x10ea21('0x88')+_0x10ea21('0xb0')+'\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\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'+_0x10ea21('0x29')+'\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\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'+_0x10ea21('0x1e')+_0x10ea21('0x10b')+'\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'+_0x10ea21('0x12c')+'\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'+_0x10ea21('0xfc')+_0x10ea21('0x2')+_0x10ea21('0x10')+_0x10ea21('0xc4')+_0x10ea21('0x153')+_0x10ea21('0x74')+'\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'+_0x10ea21('0x5b')+_0x10ea21('0x123')+_0x10ea21('0xcc')+_0x10ea21('0xfa')+'\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\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201600\x20THEN\x20\x27Help\x27'+_0x10ea21('0x108')+_0x10ea21('0xe2')+'\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'+'\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'+_0x10ea21('0xae')+_0x10ea21('0x9e')+_0x10ea21('0x32')+_0x10ea21('0x9')+'\x20\x20category\x20=\x20(SELECT'+_0x10ea21('0x12e')+_0x10ea21('0x51')+_0x10ea21('0xf2')+_0x10ea21('0xd4')+_0x10ea21('0xf4')+'\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'+_0x10ea21('0x63')+_0x10ea21('0xbd')+_0x10ea21('0x2f')+'\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\x20WHEN\x20sectionId\x20in\x20(901,\x20902,\x20910)\x20THEN\x20\x27Fax\x27'+_0x10ea21('0xb')+_0x10ea21('0x71')+_0x10ea21('0xeb')+_0x10ea21('0x99')+'\x20\x20\x20\x20\x20\x20\x20\x20WHEN\x20sectionId\x20=\x201400\x20THEN\x20\x27Settings\x27'+_0x10ea21('0x1a')+_0x10ea21('0xb6')+_0x10ea21('0x127')+_0x10ea21('0x7a')+_0x10ea21('0xc')+_0x10ea21('0xd8')+_0x10ea21('0x10f')),_0x144f7b['query'](_0x10ea21('0xfe')+_0x10ea21('0x136')),_0x144f7b['query'](_0x10ea21('0x39')+_0x10ea21('0x155')+_0x10ea21('0x13d')+_0x10ea21('0x14')+_0x10ea21('0x82')+_0x10ea21('0x21')+_0x10ea21('0x117')+_0x10ea21('0xa6')+'\x20\x20\x20\x20insertedId\x20int(11),'+_0x10ea21('0x43')+'\x20\x20);'),_0x144f7b['query'](_0x10ea21('0x4a')+_0x10ea21('0xd2')+'\x20\x20FROM\x20tmpSections'+'\x20\x20WHERE\x20name\x20in\x20(\x27Plugins\x27,\x20\x27CustomDashboards\x27);'),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0xaa')+_0x10ea21('0x139')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0xe9')+_0x10ea21('0xf1')),_0x144f7b['query'](_0x10ea21('0xe9')+'\x20\x20SET\x20sectionId\x20=\x201003\x20WHERE\x20sectionId\x20>=\x20100000;'),_0x144f7b['query'](_0x10ea21('0xe9')+'\x20\x20SET\x20autoAssociation\x20=\x201\x20WHERE\x20sectionId\x20=\x20100;'),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x91')+_0x10ea21('0x24')+_0x10ea21('0xee')+_0x10ea21('0xd')+'\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)'+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20END'+_0x10ea21('0x33')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x151')+'\x20\x20SELECT\x20name,\x20category,\x20sectionId,\x20enabled,\x20autoAssociation,\x20\x27red\x27,\x20now(),\x20now(),\x20userProfileId'+_0x10ea21('0x98')),_0x144f7b['query'](_0x10ea21('0x56')+'\x20\x20SET\x20insertedId\x20=\x20(SELECT\x20id'+_0x10ea21('0x125')+_0x10ea21('0x81')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x94')+_0x10ea21('0x14d')+_0x10ea21('0x121')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x8c')+_0x10ea21('0x155')+_0x10ea21('0x12')+_0x10ea21('0x13f')+'\x20\x20\x20\x20\x20\x20insertedSectionId\x20int(11)\x20not\x20null,'+_0x10ea21('0xa9')+_0x10ea21('0x10f')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x149')+_0x10ea21('0x145')+_0x10ea21('0x72')+_0x10ea21('0x14e')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0xac')+_0x10ea21('0x155')+_0x10ea21('0x13d')+'\x20\x20\x20\x20resourceId\x20int(11)\x20not\x20null,'+_0x10ea21('0x141')+_0x10ea21('0xd6')+_0x10ea21('0x5a')+_0x10ea21('0x10f')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x6')+'\x20\x20SELECT\x20\x27\x27,\x20resourceId,\x20type,\x20insertedSectionId,\x20sectionId'+_0x10ea21('0xc0')+'\x20\x20\x20\x20\x20\x20\x20\x20SUBSTRING_INDEX(SUBSTRING_INDEX(r.resourceId,\x20\x27,\x27,\x20tally.n),\x20\x27,\x27,\x20-1)\x20resourceId,'+_0x10ea21('0x100')+_0x10ea21('0xea')+_0x10ea21('0x14f')+'\x20\x20\x20\x20\x20\x20\x20\x20FROM\x20tally'+_0x10ea21('0x75')+'\x20\x20\x20\x20\x20\x20\x20\x20ORDER\x20BY\x20n)\x20AS\x20split;'),_0x144f7b['query']('INSERT\x20INTO\x20tmpNormalizedResources'+_0x10ea21('0x8b')+_0x10ea21('0xe5')),_0x144f7b[_0x10ea21('0x42')]('UPDATE\x20tmpNormalizedResources\x20x'+_0x10ea21('0x3e')+'\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20CASE'+'\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\x20\x20\x20\x20\x20WHEN\x20x.sectionId\x20=\x20501\x20THEN\x20COALESCE((SELECT\x20name\x20FROM\x20chat_queues\x20WHERE\x20id\x20=\x20x.resourceId),\x27DELETE_MIGRATION\x27)'+_0x10ea21('0xb2')+_0x10ea21('0x122')+_0x10ea21('0xd1')+'\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)'+_0x10ea21('0xb4')+_0x10ea21('0xca')+'\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)'+_0x10ea21('0x0')+_0x10ea21('0x13c')+_0x10ea21('0x12d')+_0x10ea21('0x8')+_0x10ea21('0x156')+'\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)'+_0x10ea21('0x48')+_0x10ea21('0x114')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x148')+_0x10ea21('0x79')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0xe')+'\x20\x20SELECT\x20name,\x20resourceId,\x20type,\x20now(),\x20now(),\x20insertedSectionId'+_0x10ea21('0xcd')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x40')+'\x20\x20SET\x20u.userProfileId\x20=\x20f.profileId'+'\x20\x20WHERE\x20u.id\x20=\x20f.userId;'),_0x144f7b['query'](_0x10ea21('0xb7')+_0x10ea21('0x61')+_0x10ea21('0xd5')),_0x144f7b[_0x10ea21('0x42')]('\x20DROP\x20TABLE\x20IF\x20EXISTS\x20tally;'),_0x144f7b['query'](_0x10ea21('0xc6')),_0x144f7b[_0x10ea21('0x42')]('DROP\x20TABLE\x20IF\x20EXISTS\x20tmpNormalizedSections;'),_0x144f7b[_0x10ea21('0x42')]('DROP\x20TABLE\x20IF\x20EXISTS\x20tmpNormalizedUsers;'),_0x144f7b[_0x10ea21('0x42')]('DROP\x20TABLE\x20IF\x20EXISTS\x20tmpExtractedResources;'),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x89')),_0x144f7b[_0x10ea21('0x42')]('DROP\x20TABLE\x20IF\x20EXISTS\x20tmpSharedProfiles;'),_0x144f7b[_0x10ea21('0x42')]('DROP\x20TABLE\x20IF\x20EXISTS\x20tmpSingleProfiles;'),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0xf7')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x68')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x35')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0xd9')),_0x144f7b[_0x10ea21('0x42')](_0x10ea21('0x111')),_0x144f7b['final'](_0x2ba63d);});},'down':function(){}};