Creates a cumulative set of operations from migration scripts.


Merge-Migration [[-Migration] <Migration[]>] [<CommonParameters>]


The Merge-Migration functions creates a cumulative set of migrations from migration scripts. If there are multiple operations across one or more migration scripts that touch the same database object, those changes are combined into one operation. For example, if you create a table in one migration, add a column in another migrations, then remove a column in a third migration, this function will output an operation that represents the final state for the object: a create table operation that includes the added column and doesn't include the removed column. In environments where tables are replicated, it is more efficient to modify objects once and have that change replicated once, than to have the same object modified multiple times and replicated multiple times.

This function returns Rivet.Migration objects. Each object will have zero or more operations in its PushOperations property. If there are zero operations, it means the original operation was consolidated into another migration. Each operation has Source member on it, which is a list of all the migrations that contributed to that operation.


Name Type Description Required? Pipeline Input Default Value
Migration Migration[]

The path to the rivet.json file to use. By default, it will look in the current directory.

false true (ByValue)

Return Values



Get-Migration | Merge-Migration

Demonstrates how to run Merge-Migration. It is always used in conjunction with Get-Migration.