rivet.ps1

A database migration tool for PowerShell.

Syntax

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>]

Description

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.

Related Commands

Parameters

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 rivet.json configuration file.

false false
ConfigFilePath String

The path to the Rivet configuration file. Default behavior is to look in the current directory for a rivet.json file. See about_Rivet_Configuration for more information.

false false
WhatIf SwitchParameter false false
Confirm SwitchParameter false false
CommonParameters This cmdlet supports common parameters. For more information type
Get-Help about_CommonParameters.

EXAMPLE 1

rivet.ps1 -New 'CreateTableStarships'

Creates a new CreateTableStarships migration in all databases.

EXAMPLE 2

rivet.ps1 -Push

Applies all migrations.

EXAMPLE 3

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.

EXAMPLE 4

rivet.ps1 -Pop

Reverts the last migration script.

EXAMPLE 5

rivet.ps1 -Pop 5

Demonstrates how to revert multiple migrations. The last -Count migrations will be popped.

EXAMPLE 6

rivet.ps1 -Pop 'AddTable'

Demonstrates how to pop a specific migration. Wildcards supported. Will match either the migration's name or ID.

EXAMPLE 7

rivet.ps1 -Redo

Reverts the last migration script, then reapplies its. Equivalent to

rivet.ps1 -Pop
rivet.ps1 -Push

EXAMPLE 8

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