A database migration tool for PowerShell.
rivet.ps1 [-WhatIf] [-Confirm] [<CommonParameters>]
rivet.ps1 -New [-Name] <String[]> [[-Database] <String[]>] [-Environment <String>] [-ConfigFilePath <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
rivet.ps1 -Push [[-Name] <String[]>] [-Database <String[]>] [-Environment <String>] [-ConfigFilePath <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
rivet.ps1 -Pop -All [-Force] [-Database <String[]>] [-Environment <String>] [-ConfigFilePath <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
rivet.ps1 -Pop [-Name] <String[]> [-Force] [-Database <String[]>] [-Environment <String>] [-ConfigFilePath <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
rivet.ps1 -Pop [-Count] <UInt32> [-Force] [-Database <String[]>] [-Environment <String>] [-ConfigFilePath <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
rivet.ps1 -Pop [-Force] [-Database <String[]>] [-Environment <String>] [-ConfigFilePath <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
rivet.ps1 -Redo [-Database <String[]>] [-Environment <String>] [-ConfigFilePath <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Rivet is a database migration tool for SQL Server. Finally!
This script is the entry point for Rivet. It is used to create a new migration, and apply/revert migrations against a database.
Called without any arguments, Rivet will shows this help topic.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
New | SwitchParameter | Creates a new migration. |
true | false | False |
Push | SwitchParameter | Applies migrations. |
true | false | False |
Pop | SwitchParameter | Reverts migrations. |
true | false | False |
Redo | SwitchParameter | Reverts a migration, then re-applies it. |
true | false | False |
Name | String[] | The name of the migrations to create, push, or pop. Matches against the migration's ID, Name, or file name (without extension). Wildcards permitted. |
true | false | |
Count | UInt32 | The number of migrations to pop. Default is 1. |
true | false | 1 |
All | SwitchParameter | Pop all migrations |
true | false | False |
Force | SwitchParameter | Force popping a migration you didn't apply or that is old. |
false | false | False |
Database | String[] | The database(s) to migrate. Optional. Will operate on all databases otherwise. |
false | false | |
Environment | String | The environment you're working in. Controls which settings Rivet loads from the |
false | false | |
ConfigFilePath | String | The path to the Rivet configuration file. Default behavior is to look in the current directory for a |
false | false | |
WhatIf | SwitchParameter | false | false | ||
Confirm | SwitchParameter | false | false | ||
CommonParameters | This cmdlet supports common parameters. For more information type Get-Help about_CommonParameters . |
rivet.ps1 -New 'CreateTableStarships'
Creates a new CreateTableStarships
migration in all databases.
rivet.ps1 -Push
Applies all migrations.
rivet.ps1 -Push 'CreateTableStarships'
Demonstrates how to apply a named migration. Don't include the timestamp. Wildcards are permitted.
Be careful with this syntax! If the named migration(s) depend on other migrations that haven't been run, the migration will fail.
rivet.ps1 -Pop
Reverts the last migration script.
rivet.ps1 -Pop 5
Demonstrates how to revert multiple migrations. The last -Count
migrations will be popped.
rivet.ps1 -Pop 'AddTable'
Demonstrates how to pop a specific migration. Wildcards supported. Will match either the migration's name or ID.
rivet.ps1 -Redo
Reverts the last migration script, then reapplies its. Equivalent to
rivet.ps1 -Pop
rivet.ps1 -Push
rivet.ps1 -Push -Environment Production
Demonstrates how to migrate databases in a different environment. The Production
environment should be specified in the rivet.json
configuration file.
Requires -Version 3