| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- USE trs_data_migration;
- DROP PROCEDURE IF EXISTS sp_city_n;
- DELIMITER $$
- CREATE PROCEDURE sp_city_n(IN n INT)
- BEGIN
- # 每迁移一个wcm节点,@n 必须 +1
- SET @n = n;
- # 每个wcm节点,元数据表需要加上后缀,以区分同名元数据表
- SET @citySuffix = concat('_city', @n);
- # 支持断点续传,上一次迁移的最后一个 xx ID
- SET @prevSiteId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'wcmwebsite'), 0);
- SET @prevChannelId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'wcmchannel'), 0);
- SET @prevRecId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'wcmchnldoc'), 0);
- SET @prevDocId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'wcmdocument'), 0);
- SET @prevChannelSynId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'wcmchannelsyn'), 0);
- SET @prevFolderPublishConfigId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'wcmfolderpublishconfig'), 0);
- SET @prevTemplateId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'wcmtemplate'), 0);
- SET @prevTemplateArgId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'wcmtemplateargument'), 0);
- SET @prevTemplateEmployId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'wcmtemplateemploy'), 0);
- SET @prevTemplateNestId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'wcmtemplatenest'), 0);
- SET @prevTemplateQuoteId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'wcmtemplatequote'), 0);
- SET @prevClassInfoId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'xwcmclassinfo'), 0);
- SET @prevClassInfoViewId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'xwcmclassinfoview'), 0);
- SET @prevFieldId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'xwcmdbfieldinfo'), 0);
- SET @prevMetaViewEmployerId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'xwcmmetaviewemployer'), 0);
- SET @prevTableInfoId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'xwcmtableinfo'), 0);
- SET @prevViewFieldInfoId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'xwcmviewfieldinfo'), 0);
- SET @prevViewId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'xwcmviewinfo'), 0);
- SET @prevMetaViewFieldGroupId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'xwcmmetaviewfieldgroup'), 0);
- SET @prevAppendixId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'wcmappendix'), 0);
- # xx ID 偏移量,为了和海云系统中的 xx ID 错开一段距离
- SET @siteIdOffset = 100000 * @n;
- SET @viewIdOffset = 100000 * @n;
- SET @tableInfoIdOffset = 100000 * @n;
- SET @metaViewFieldGroupIdOffset = 100000 * @n;
- SET @classInfoViewIdOffset = 100000 * @n;
- SET @classInfoIdOffset = 100000 * @n;
- SET @fieldIdOffset = 1000000 * @n;
- SET @metaViewEmployerIdOffset = 100000 * @n;
- SET @viewFieldInfoIdOffset = 100000 * @n;
- SET @dbFieldIdOffset = 100000 * @n;
- SET @channelIdOffset = 1000000 * @n;
- SET @channelSynIdOffset = 1000000 * @n;
- SET @templateIdOffset = 1000000 * @n;
- SET @folderPublishConfigIdOffset = 1000000 * @n;
- SET @templateArgIdOffset = 1000000 * @n;
- SET @templateEmployIdOffset = 1000000 * @n;
- SET @templateNestIdOffset = 1000000 * @n;
- SET @templateQuoteIdOffset = 1000000 * @n;
- SET @appendixIdOffset = 10000000 * @n;
- SET @recIdOffset = 10000000 * @n;
- SET @docIdOffset = 10000000 * @n;
- call sp_data_migration_wcmappendix(@prevAppendixId, @appendixIdOffset, @docIdOffset);
- call sp_data_migration_wcmchannel(@prevChannelId, @siteIdOffset, @channelIdOffset);
- call sp_data_migration_wcmchannelchildindexquote(@templateIdOffset, @siteIdOffset, @channelIdOffset);
- call sp_data_migration_wcmchannelsyn(@prevChannelSynId, @channelSynIdOffset, @channelIdOffset);
- call sp_data_migration_wcmchnldoc(@prevRecId, @recIdOffset, @docIdOffset, @siteIdOffset, @channelIdOffset);
- call sp_data_migration_wcmdocument(@prevDocId, @prevDocId, @viewIdOffset, @siteIdOffset, @channelIdOffset);
- call sp_data_migration_wcmfolderpublishconfig(@prevFolderPublishConfigId, @folderPublishConfigIdOffset, @siteIdOffset, @channelIdOffset);
- call sp_data_migration_wcmtemplate(@prevTemplateId, @templateIdOffset, @siteIdOffset, @channelIdOffset);
- call sp_data_migration_wcmtemplateargument(@prevTemplateArgId, @templateArgIdOffset, @templateIdOffset, @siteIdOffset, @channelIdOffset);
- call sp_data_migration_wcmtemplateemploy(@prevTemplateEmployId, @templateEmployIdOffset, @templateIdOffset, @siteIdOffset, @channelIdOffset);
- call sp_data_migration_wcmtemplatenest(@prevTemplateNestId, @templateNestIdOffset);
- call sp_data_migration_wcmtemplatequote(@prevTemplateQuoteId, @templateQuoteIdOffset, @templateIdOffset, @siteIdOffset, @channelIdOffset);
- call sp_data_migration_wcmwebsite(@citySuffix, @prevSiteId, @siteIdOffset);
- call sp_data_migration_xwcmclassinfo(@prevClassInfoId, @classInfoIdOffset);
- call sp_data_migration_xwcmclassinfoview(@prevClassInfoViewId, @classInfoViewIdOffset, @classInfoIdOffset, @docIdOffset, @viewIdOffset);
- call sp_data_migration_xwcmdbfieldinfo(@citySuffix, @prevFieldId, @fieldIdOffset, @prevClassInfoId, @tableInfoIdOffset);
- call sp_data_migration_xwcmmetaviewemployer(@prevMetaViewEmployerId, @metaViewEmployerIdOffset, @viewIdOffset, @siteIdOffset, @channelIdOffset);
- call sp_data_migration_xwcmmetaviewfieldgroup(@prevMetaViewFieldGroupId, @metaViewFieldGroupIdOffset, @viewIdOffset);
- call sp_data_migration_xwcmtableinfo(@citySuffix, @prevTableInfoId, @tableInfoIdOffset);
- call sp_data_migration_xwcmviewfieldinfo(@citySuffix, @prevViewFieldInfoId, @viewFieldInfoIdOffset, @tableInfoIdOffset, @prevClassInfoId, @dbFieldIdOffset, @metaViewFieldGroupIdOffset, @viewIdOffset, @viewIdOffset);
- call sp_data_migration_xwcmviewinfo(@citySuffix, @prevViewId, @viewIdOffset, @tableInfoIdOffset);
- call sp_data_migration_wcmmetatable(@citySuffix, @prevTableInfoId, @prevDocId, @docIdOffset, @channelIdOffset);
- # 迁移 MAS 视频,6个wcm节点的视频是在一起的。可重复执行。
- # 支持断点续传,上一次迁移的最后一个 xx ID
- SET @prevMasId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'mas_masid'), 0);
- SET @prevMasVideoId = ifnull((SELECT prev_id from trs_data_migration.data_migration_log where table_name = 'mas_masvideo'), 0);
- SET @masIdOffset = 1000000;
- SET @masVideoIdOffset = 1000000;
- call trs_data_migration.sp_data_migration_masid(@prevMasId, @masIdOffset);
- call trs_data_migration.sp_data_migration_masvideo(@prevMasVideoId, @masVideoIdOffset);
- END $$
- DELIMITER ;
|