【问题标题】:copy tenant from one db to another将租户从一个数据库复制到另一个数据库
【发布时间】:2014-11-24 12:53:34
【问题描述】:

是否可以复制例如从 DB1 到 DB2 的 junit-Tenant,如果是,如何?

问题是当我连接到另一个数据库(目前没有初始化 junit-tenant)时,我不想丢失我的测试数据

非常感谢!

【问题讨论】:

    标签: junit hybris


    【解决方案1】:

    您可以使用 Impex 执行此操作(但可能会出现一些错误),并且您必须单独设置密码(至少 AFAIK)。 此外,hybris 从不删除数据库中的字段。您必须从 DB1 中删除过去可能已经创建但不再是数据模型一部分的属性(因此不在 DB2 上创建)。

    导出(无密码):

    1. 系统 -> 工具 -> 脚本生成器
    2. 点击“生成”
    3. 复制结果内容。
    4. 从脚本中删除这些字段:[@password, encodedPassword, password, passwordAnswer,passwordEncoding,passwordQuestion] 从生成的脚本中
    5. 转到系统 -> 工具 -> 导出
    6. 选择模式(重新)轻松导入
    7. 粘贴之前复制的脚本
    8. 点击保存
    9. 点击运行
    10. 完成后,下载目标结果(数据 + 媒体 zip 文件)

    导出密码:

    1. 转到系统 -> 工具 -> 导出
    2. 选择模式(重新)导入严格
    3. 粘贴此内容:

      ---------------------------------------------- --------

      # 在脚本生成期间使用的“标头验证模式”是:import_strict

      "#% impex.setLocale(new Locale(""en"" , """"));"

      ---------------------------------------------- --------

      ---- 扩展:核心----类型:用户----

      "#% impex.setTargetFile(""User.csv"");" insert_update User;&Item;@password[translator=de.hybris.platform.impex.jalo.translators.UserPasswordTranslator];encodedPassword;password;passwordAnswer;passwordEncoding;passwordQuestion;uid[unique=true,allownull=true] "#% impex.exportItems(""User"", false);"

      ---- 扩展:核心----类型:客户----

      "#% impex.setTargetFile(""Customer.csv"");" insert_update Customer;&Item;@password[translator=de.hybris.platform.impex.jalo.translators.UserPasswordTranslator];encodedPassword;password;passwordAnswer;passwordEncoding;passwordQuestion;uid[unique=true,allownull=true] "#% impex.exportItems(""客户"" , false );"

      ---- 扩展:核心----类型:员工----

      "#% impex.setTargetFile(""Employee.csv"");" insert_update Employee;&Item;@password[translator=de.hybris.platform.impex.jalo.translators.UserPasswordTranslator];encodedPassword;password;passwordAnswer;passwordEncoding;passwordQuestion;uid[unique=true,allownull=true] "#% impex.exportItems(""Employee"" , false );"

    4. 点击保存

    5. 点击运行
    6. 完成后,下载目标结果

    导入(无密码):

    • 转到系统 -> 工具 -> 导入
    • 在“导入文件”中上传数据压缩文件
    • 将本地设置设为“en”(或您在导出脚本中使用的那个)
    • 设置模型导入轻松
    • 将错误模式设置为忽略
    • 点击下一步
    • 在“导入媒体”中上传媒体 zip 文件
    • 点击开始

    导入密码:

    • 转到系统 -> 工具 -> 导入
    • 在“导入文件”中上传数据压缩文件
    • 将本地设置设为“en”(或您在导出脚本中使用的那个)
    • 将模型设置为严格导入
    • 将错误模式设置为忽略
    • 点击开始

    【讨论】:

      【解决方案2】:

      并非没有付出巨大的努力。没有简单的方法。

      你能做的最好的就是总是从 impex 初始化你的数据。

      【讨论】:

        猜你喜欢
        • 2017-04-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-04-16
        • 1970-01-01
        • 2016-07-28
        相关资源
        最近更新 更多