Skip to content

Migration Plans

Jannis Schreiber edited this page Nov 25, 2024 · 8 revisions

Migration plans allow you to program a series of steps that to export data from a source org and import this data to a target org.

The plugin currently only supports data export.

Configuring a Plan

A plan consists of a name and an ordered list of objects to export.

name: Simple Test Plan
objects:
  - objectName: Account
    queryString: SELECT Id,Name FROM Account

A more complex example shows the variations

name: Complex Test Plan
objects:
  - objectName: Account
    queryFile: test/data/soql/accounts.sql
    exportIds: myAccountIds
  - objectName: Contact
    query:
      fetchAllFields: true
      parent:
        field: AccountId
        variable: myAccountIds
  - objectName: Order
    queryString: SELECT Id,AccountId,BillToContactId FROM Order LIMIT 100
  - objectName: Opportunity
    queryString: SELECT Id,AccountId FROM Opportunity LIMIT 10

Define the Query

...

Exports and Parent Binds

...

Running an Export

Once your plan is configured, you should quickly validate it against the source org. This command will try to resolve all objectNames in your plan, verify that bound parent ids are exported before using them, and that all query strings resolve to valid SOQL.

sf jsc data export -p my-test-plan.yaml -o MyProductionOrg --validate-only

Then, then it. The default output directory is an exports/plan-name folder in your project root.

sf jsc data export -p my-test-plan.yaml -o MyProductionOrg

Clone this wiki locally