Apache License 2.0

项目介绍

forcedotcom/SFDX-Data-Move-Utility 是一个托管在 GitHub 上的开源项目,主要使用 TypeScript 编写,采用 Apache License 2.0 许可证,目前获得 559 个 Star、94 次 Fork。

仓库全名
forcedotcom/SFDX-Data-Move-Utility
开源许可证
Apache License 2.0
Star 数
559
Fork 数
94
未关闭 Issue
19

README 摘要

The SFDX Data Move Utility (SFDMU) is an advanced SF CLI plugin designed to streamline data migration within various Salesforce environments, including scratch, development, sandbox, and production orgs. This powerful tool supports migration from other Salesforce orgs or CSV files and efficiently manages various data operations, enabling the migration of multiple related sObjects in a single run. SFDMU GUI Desktop…

完整内容见 GitHub 原始 README 或本页 。

常见问题

SFDX-Data-Move-Utility 用什么语言开发?

主要使用 TypeScript 编写,采用 Apache License 2.0 许可证,目前有 559 个 Star。

SFDX-Data-Move-Utility 可以免费商用吗?

仓库采用 Apache License 2.0 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 SFDX-Data-Move-Utility 的源码?

可以直接克隆仓库:git clone https://github.com/forcedotcom/SFDX-Data-Move-Utility.git,默认分支为 master;安装与运行步骤见仓库 README。

SFDX-Data-Move-Utility 最近还在维护吗?

仓库最近一次更新为 7月4日,当前有 19 个未关闭 Issue;Star 数为 559,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

SFDMU is a cutting-edge Salesforce data migration tool for seamless org population from other orgs or CSV files. It handles all CRUD operations on multiple related objects in one go.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

语言占比

Batchfile
JavaScript
Shell
TypeScript

Release

README

SFDMU SFDX Data Move Utility (SFDMU)

Version Downloads/week Downloads/total GitHub stars GitHub contributors License PRs Welcome

The SFDX Data Move Utility (SFDMU) is an advanced SF CLI plugin designed to streamline data migration within various Salesforce environments, including scratch, development, sandbox, and production orgs.

This powerful tool supports migration from other Salesforce orgs or CSV files and efficiently manages various data operations, enabling the migration of multiple related sObjects in a single run.

Version Notice

We recently released a new improved v5 version of the SFDMU plugin, built on the latest SF CLI plugin architecture and including the latest available security updates. We recommend using the latest available plugin version. If it does not work correctly in your environment yet, temporarily roll back to v4.39.0. SFDMU is supported as an SF CLI plugin (sf sfdmu run). Full migration guidance is available on Get Started.

Key Features:

  • Comprehensive Migration Support: Enables direct Org-to-Org data migration, eliminating the need for CSV intermediates, and supports CRUD operations: Insert, Upsert, Update, Delete.
  • Multiple Objects and Relationships: Manages migrations involving multiple object sets and handles complex relationships, including circular references.
  • Ease of Use: Simplifies the configuration process with a single export.json file.
  • Secure and Local: Ensures data security as all operations are performed locally without cloud interactions.
  • High Performance: Optimizes processing by focusing on necessary data subsets.
  • Extended Functionality: Provides advanced features such as custom field mapping, data anonymization, and supports composite external ID keys among others.

Installation Instructions:

  1. Prepare Environment: Install the Salesforce CLI following the official instructions.

  2. Install the new improved version of the plugin (recommended):

    # Uninstall old version, if any:
    $ sf plugins uninstall sfdmu
    
    # Install the latest published plugin version:
    $ sf plugins install sfdmu@latest
    
  3. Temporarily roll back to the previous stable line if the new improved version does not work yet:

    # Remove current plugin:
    $ sf plugins uninstall sfdmu
    
    # Install previous stable version:
    $ sf plugins install [email protected]
    
  4. Switch back to the new improved version later:

    $ sf plugins install sfdmu@latest
    
  5. If you need to pin a specific plugin version:

    $ sf plugins install sfdmu@<version>
    
  6. If you find a bug in the new improved version of the plugin, please report it with diagnostic logs:

    $ sf sfdmu run --sourceusername [email protected] --targetusername [email protected] --diagnostic --anonymise
    

    Attach the full generated .log file, your export.json, and related CSV samples. --anonymise hashes sensitive values in .log files before sharing. Full masking list: Log File Management in Plugin Migrations.

For Developers:

Detailed Setup

For developers needing customization or access to the source:

# Clone the repository:
$ git clone https://github.com/forcedotcom/SFDX-Data-Move-Utility
# Navigate to the directory and link it:
$ cd SFDX-Data-Move-Utility
$ npm install
$ sf plugins link

Debugging

Use the source-debug flow from the official debugging guide:

$ ./sfdmu-run-debug.cmd --sourceusername [email protected] --targetusername [email protected] --path .

In VSCode, enable Node Debug -> Auto Attach (On) and set Use Preview Auto Attach to Off.

For detailed debugging guidance, see Debugging Steps.

Migration Configuration:

Set up a migration job by creating an export.json file with specific data models and operations, as detailed in the Full export.json Format Guide.

Here is a basic export.json example for upserting Accounts and their related Contacts, assuming a unique Name for Accounts and a unique LastName for Contacts across source and target orgs:

{
  "objects": [
    {
      "operation": "Upsert",
      "externalId": "LastName",
      "query": "SELECT FirstName, LastName, AccountId FROM Contact",
      "master": false
    },
    {
      "operation": "Upsert",
      "externalId": "Name",
      "query": "SELECT Name, Phone FROM Account WHERE Name = 'John Smith'"
    }
  ]
}

For full object model details, advanced parameters, and edge cases, use: Get Started and Detailed export.json Format.

Migration Execution:

Navigate to the directory where your export.json file is located and execute migrations using commands tailored to your source and target, whether they are Salesforce orgs or CSV files:

# Migrate data from one Salesforce org to another
$ sf sfdmu run --sourceusername [email protected] --targetusername [email protected]

# Export data from a Salesforce org to CSV files
$ sf sfdmu run --sourceusername [email protected] --targetusername csvfile

# Import data from CSV files to a Salesforce org
$ sf sfdmu run --sourceusername csvfile --targetusername [email protected]

SFDMU execution is plugin-only. Standalone Node.js module run mode is not supported.

Note:

When importing or exporting from/to CSV files, ensure that the files are located in the directory containing the export.json file. The files should be named according to the API name of the respective sObject, such as Account.csv, Contact.csv. This naming convention helps in accurately mapping the data to the correct sObjects during the import or export process.

Watch the Demo

  • Experience the plugin in action here.

Additional Notes

  • If you encounter permission issues on MacOS, prepend your commands with sudo. Adjust CLI command syntax if using the older SFDX CLI platform.
  • To allow SFDMU to connect to your source and target orgs, ensure you have established a local connection to these orgs using the standard sf org login web commands, as detailed in the Authorize an Org Using a Browser documentation.

评论

暂无评论