-
Notifications
You must be signed in to change notification settings - Fork 10
pacx table defineMigrationStrategy
Builds the data migration strategy to populate all the tables contained in a given solution
pacx table defmigThis command comes handy when you need to define the strategy to migrate data on a set of tables that are strictly tied together in a complex relationship graph.
Starting from a set of tables contained in a given solution (if specified, otherwise it will fallback on the default solution set for this environment via pacx solution setDefault), it builds a directed graph and navigates into the graph to untangle the relationship chains, in a recursive pattern.
The untangling approach has the following pattern:
- Repeat while the chart contains nodes
- Extract the 'leaf nodes' from the graph (a leaf is a node that has no outbound relations - no lookup columns)
- If found
- Each leaf node can be imported directly
- Remove the leaf nodes from the graph, and all the relations directed towards the leaf nodes
- If not found, and there are still nodes in the graph, it means we have a cycle (a cycle is a set of nodes that are mutually related to each other)
- Extract the 'cycles' from the graph
- If the cycle is just one, untangle the cycle
- If the cycles are more than one
- Extract any self-loop that is also self-contained (a self contained cycle is a cycle which nodes are related exclusively to other nodes of the cycle)
- If found, untangle those self-loops and return to bullet 1
- If not found
- Extract any self-contained cycle that is not a self-loop
- If found, untangle those self-contained cycles and return to bullet 1
- If not found, it means that there is a complex relationship graph that cannot be managed by the algorithm, and needs to be untangled manually
- The algorithm breaks with an error, and prints the loops that he was not able to untangle
When we say untangle the cycle it means that:
- if the cycle is a self-loop
- import the table records without the lookup colum
- the update the imported records setting the lookup column
- remove the table from the graph
- otherwise break the chain in any point, properly managing self-loops that can be present in specific nodes of the cycle
- once defined the breaking point, import the table without the lookup column
- move to the next table of the chain, and import that table fully
- repeat the process until all the tables in the chain are imported
- update the table imported in step 2.1 with lookup columns
- remove the tables from the graph
At the end of the execution, the command prints a sequence of commands that can be:
- Full import on table 'table name'
- Import table 'table name' without column(s) 'columns to ignore during the import'
- Update table 'table name' to set column(s) 'columns to update'
xrm table defineMigrationStrategy --solution "my_solution_unique_name"
xrm table defmig --solution "my_solution_unique_name"Use the --verbose (-v) argument to display additiona information about the sequence of operations used to build the migration strategy.
| Long Name | Short Name | Required? | Description | Default value | Valid values |
|---|---|---|---|---|---|
solution |
s |
N | The name of the solution containing the entities to export. If not specified, the default solution is used instead. | - | String |
include-security-tables |
ist |
N | If false, the security tables (organization, systemuser, businessunit, team, position, fieldsecurityprofile) are not taken consideration in the export. | False |
true, false |
skip-missing-tables |
skip |
N | If true, the command will not fail if some tables are missing in the solution. The missing tables will be skipped. | False |
true, false |
verbose |
v |
N | If true, the command will output more information about the export process. | False |
true, false |