Skip to content

Commit

Permalink
Code review feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
KhoiKy committed Apr 3, 2023
1 parent 4f4fe1f commit a7f3ed1
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 83 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

* `Checkpoint-Migration` will no longer delete migration scripts that have been pushed to the database. Instead it
will now export rows from the `rivet.Migrations` table and include them in the `schema.ps1` file.
* Added an `Initialize-Schema` switch to the `Invoke-Rivet` script that is used to initialize database(s) with the
* Added an `InitializeSchema` switch to the `Invoke-Rivet` script that is used to initialize database(s) with the
`schema.ps1` file that is generated from `Checkpoint-Migration`.


Expand Down
17 changes: 10 additions & 7 deletions Rivet/Functions/Export-Migration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1626,20 +1626,23 @@ where
SELECT *
FROM rivet.Migrations
WHERE ID > $($script:firstMigrationId)"

function Export-RivetMigrationsTable
{
[CmdletBinding()]
param()

foreach( $row in $rivetMigrationsTableData )
{
" Add-Row -SchemaName 'rivet' -TableName 'Migrations' -Column @{"
" ID = '$($row.Id)';"
" Name = '$($row.Name)';"
" Who = '$($row.Who)';"
" ComputerName = '$($row.ComputerName)';"
" AtUtc = '$($row.AtUtc.ToString("MM/dd/yyyy HH:mm:ss.fffffff"))';"
" }"
@"
Add-Row -SchemaName 'rivet' -TableName 'Migrations' -Column @{
ID = '$($row.Id)';
Name = '$($row.Name)';
Who = '$($row.Who)';
ComputerName = '$($row.ComputerName)';
AtUtc = '$($row.AtUtc.ToString("MM/dd/yyyy HH:mm:ss.fffffff"))';
}
"@
}
}

Expand Down
2 changes: 1 addition & 1 deletion Rivet/Functions/Invoke-Rivet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function Invoke-Rivet

[Parameter(ParameterSetName='InitializeSchema')]
[Switch]
# Initializes the database using the contents of the schema.ps1 file that was created from checkpoint.
# Initializes the database, including baseline schema. Use the -Checkpoint switch to create a database baseline.
$InitializeSchema
)

Expand Down
2 changes: 1 addition & 1 deletion Rivet/rivet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ param(

[Parameter(ParameterSetName='InitializeSchema')]
[Switch]
# Initializes the database using the contents of the schema.ps1 file that was created from checkpoint.
# Initializes the database, including baseline schema. Use the -Checkpoint switch to create a database baseline.
$InitializeSchema
)

Expand Down
Loading

0 comments on commit a7f3ed1

Please sign in to comment.