forked from red-gate/Flyway-Sample-Pipelines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomated-capture.ps1
23 lines (17 loc) · 1.15 KB
/
automated-capture.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# https://documentation.red-gate.com/fd/flyway-dev-command-line-180715525.html
# Define base path
# $basePath = Get-Location
$basePath = "C:\WorkingFolders\FWD\Pagila"
# Define variables for paths
$flywayTomlPath = Join-Path $basePath "flyway.toml"
$schemaDeltasPath = Join-Path $basePath "schemaDeltas.zip"
$deploymentDeltasPath = Join-Path $basePath "deploymentDeltas.zip"
$outputFolderPath = Join-Path $basePath "migrations"
# Diff between Dev and SchemaModel
$schemaDiffs = flyway-dev diff -p $flywayTomlPath --i-agree-to-the-eula --from=Dev --to=SchemaModel -a $schemaDeltasPath --output json | ConvertFrom-Json
# Apply differences to SchemaModel
echo $schemaDiffs.differences.id | flyway-dev apply -p $flywayTomlPath -a $schemaDeltasPath --verbose --i-agree-to-the-eula
# Diff between SchemaModel and Migrations
flyway-dev diff -p $flywayTomlPath --i-agree-to-the-eula --from=SchemaModel --to=Migrations -a $deploymentDeltasPath
# Take and generate migrations
flyway-dev take -p $flywayTomlPath -a $deploymentDeltasPath --i-agree-to-the-eula | flyway-dev generate -p $flywayTomlPath -a $deploymentDeltasPath --i-agree-to-the-eula --outputFolder=$outputFolderPath