


use trs_hycloud_iip;

# 每迁移一个wcm节点，@n 必须手动 +1
SET @n = 2;

# 每个wcm节点，元数据表需要加上后缀，以区分同名元数据表
SET @citySuffix = concat('_city', @n);




# 支持断点续传，上一次迁移的最后一个 xx ID
SET @prevSiteId = 0;
SET @prevChannelId = 0;
SET @prevRecId = 0;
SET @prevDocId = 0;
SET @prevChannelSynId = 0;
SET @prevFolderPublishConfigId = 0;
SET @prevTemplateId = 0;
SET @prevTemplateArgId = 0;
SET @prevTemplateEmployId = 0;
SET @prevTemplateNestId = 0;
SET @prevTemplateQuoteId = 0;
SET @prevClassInfoId = 0;
SET @prevClassInfoViewId = 0;
SET @prevFieldId = 0;
SET @prevMetaViewEmployerId = 0;
SET @prevTableInfoId = 0;
SET @prevViewFieldId = 0;
SET @prevViewId = 0;
SET @prevMetaViewFieldGroupId = 0;
SET @prevAppendixId = 0;



# xx ID 偏移量，为了和海云系统中的 xx ID 错开一段距离
SET @siteIdOffset = 1000 * @n;
SET @channelIdOffset = 100000 * @n;
SET @channelSynIdOffset = 100000 * @n;
SET @templateIdOffset = 100000 * @n;
SET @recIdOffset = 10000000 * @n;
SET @docIdOffset = 10000000 * @n;
SET @viewIdOffset = 1000 * @n;
SET @folderPublishConfigIdOffset = 100000 * @n;
SET @templateArgIdOffset = 100000 * @n;
SET @templateEmployIdOffset = 1000000 * @n;
SET @templateNestIdOffset = 100000 * @n;
SET @templateQuoteIdOffset = 1000000 * @n;
SET @classInfoIdOffset = 10000 * @n;
SET @fieldIdOffset = 100000 * @n;
SET @tableInfoIdOffset = 1000 * @n;
SET @metaViewEmployerIdOffset = 100000 * @n;
SET @viewFieldIdOffset = 100000 * @n;
SET @dbFieldIdOffset = 100000 * @n;
SET @fieldGroupIdOffset = 1000 * @n;
SET @metaViewFieldGroupIdOffset = 1000 * @n;
SET @appendixIdOffset = 10000000 * @n;



call p_data_migration_wcmappendix(@prevAppendixId, @appendixIdOffset, @docIdOffset);
call p_data_migration_wcmchannel(@prevChannelId, @siteIdOffset, @channelIdOffset);
call p_data_migration_wcmchannelchildindexquote(@templateIdOffset, @siteIdOffset, @channelIdOffset);
call p_data_migration_wcmchannelsyn(@prevChannelSynId, @channelSynIdOffset, @channelIdOffset);
call p_data_migration_wcmchnldoc(@prevRecId, @recIdOffset, @prevDocId, @siteIdOffset, @channelIdOffset);
call p_data_migration_wcmdocument(@prevDocId, @prevDocId, @viewIdOffset, @siteIdOffset, @channelIdOffset);
call p_data_migration_wcmfolderpublishconfig(@prevFolderPublishConfigId, @folderPublishConfigIdOffset, @siteIdOffset, @channelIdOffset);
call p_data_migration_wcmtemplate(@prevTemplateId, @templateIdOffset, @siteIdOffset, @channelIdOffset);
call p_data_migration_wcmtemplateargument(@prevTemplateArgId, @templateArgIdOffset, @siteIdOffset, @channelIdOffset);
call p_data_migration_wcmtemplateemploy(@prevTemplateEmployId, @templateEmployIdOffset, @templateIdOffset, @siteIdOffset, @channelIdOffset);
call p_data_migration_wcmtemplatenest(@prevTemplateNestId, @templateNestIdOffset);
call p_data_migration_wcmtemplatequote(@prevTemplateQuoteId, @templateQuoteIdOffset, @templateIdOffset, @siteIdOffset, @channelIdOffset);
call p_data_migration_wcmwebsite(@prevSiteId, @siteIdOffset);
call p_data_migration_xwcmclassinfo(@prevClassInfoId, @classInfoIdOffset);
call p_data_migration_xwcmclassinfoview(@prevClassInfoViewId, @classInfoIdOffset, @docIdOffset, @viewIdOffset);
call p_data_migration_xwcmdbinfo(@citySuffix, @prevFieldId, @fieldIdOffset, @prevClassInfoId, @tableInfoIdOffset);
call p_data_migration_xwcmmetaviewemployer(@prevMetaViewEmployerId, @metaViewEmployerIdOffset, @channelIdOffset);
call p_data_migration_xwcmmetaviewfieldgroup(@prevMetaViewFieldGroupId, @metaViewFieldGroupIdOffset, @viewIdOffset);
call p_data_migration_xwcmtableinfo(@citySuffix, @prevTableInfoId, @tableInfoIdOffset);
call p_data_migration_xwcmviewfieldinfo(@citySuffix, @prevViewFieldId, @viewFieldIdOffset, @tableInfoIdOffset, @prevClassInfoId, @dbFieldIdOffset, @fieldGroupIdOffset, @viewIdOffset, @viewIdOffset);
call p_data_migration_xwcmviewinfo(@citySuffix, @prevViewId, @viewIdOffset, @mainTableIdOffset);
call p_data_migration_wcmmetatable(@prevTableInfoId, @prevDocId, @docIdOffset, @channelIdOffset);


