Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions Check/Check_ConsolidateReports.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<#
.SYNOPSIS
Consolidates Flyway reports to validate schema consistency, drift, and code checks.

.DESCRIPTION
This script runs `flyway info check` against a schema model and a target environment.
It consolidates key checks into one command:
- Schema changes
- Drift detection
- Code consistency validation
The script can optionally output a consolidated HTML report for sharing with
stakeholders (e.g., DBAs, QA, or release managers).

.USECASE
- Ensure production matches the expected schema model before/after a release.
- Detect drift or inconsistencies introduced outside of Flyway (manual changes, hotfixes).
- Generate reports for audits, compliance, or deployment reviews.
- Validate that schema and migration scripts remain in sync across environments.

.NOTES
- Replace `schema-model` with the correct schema model path for your project.
- Use `-reportFilename` to generate an HTML file for easier distribution/review.
- The `-dryrun` flag ensures no changes are applied; this is purely a reporting step.
- `-check.buildEnvironment` compares the schema model against the specified build environment.

.FILENAME
Check_ConsolidateReports.ps1
#>

# Consolidate reports for schema changes, drift, and code consistency
# Check report with drift, dryrun, changes, and code checks. Control the reports file name and location. Can consolidate reports to one place.
flyway info check -code -changes -drift -dryrun -schemaModelLocation="schema-model" -environment=Production -check.buildEnvironment=build -reportFilename="flyway_consolidated_reports.html"
47 changes: 47 additions & 0 deletions Check/Check_ConsolidateReports_Snapshots.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<#
.SYNOPSIS
Consolidates Flyway reports by comparing pre- and post-release snapshots.

.DESCRIPTION
This script generates and compares snapshots of a production database
before and after a release. It uses Flyway `check` and `info check` commands
to consolidate information about:
- Schema changes
- Drift detection
- Code consistency
The results help DBAs and DevOps engineers verify what changed during a deployment.

.USECASE
- Capture a pre-release snapshot of production for baseline comparison.
- Capture a post-release snapshot after deployment.
- Run checks to validate changes, detect drift, and consolidate results.
- Generate reports that can be used in release reviews, audits, or post-mortems.

.NOTES
- Replace file paths with project-specific snapshot storage locations.
- The `-dryrun` flag allows safe testing of the report without applying changes.

.FILENAME
Check_ConsolidateReports_Snapshots.ps1
#>

# -----------------------------
# Step 1: Take snapshots (before and after release)
# -----------------------------
flyway snapshot "-source=production" "-filename=C:\Projects\AdventureWorks\snapshots\snapshot-pre-release.json"
flyway snapshot "-source=production" "-filename=C:\Projects\AdventureWorks\snapshots\snapshot-post-release.json"

# -----------------------------
# Step 2: Run change checks between snapshots
# -----------------------------
# Basic check for schema changes
flyway check -changes -environment="production" -deployedSnapshot="C:\Projects\AdventureWorks\snapshots\snapshot-pre-release.json" -nextSnapshot="C:\Projects\AdventureWorks\snapshots\snapshot-post-release.json"

# -----------------------------
# Step 3: Generate consolidated check reports
# -----------------------------
# Check report with drift, dryrun, changes, and code checks. Control the reports file name and location. Can consolidate reports to one place.
flyway info check -changes -drift -code -dryrun -environment="production" -deployedSnapshot="C:\Projects\AdventureWorks\snapshots\snapshot-pre-release.json" -nextSnapshot="C:\Projects\AdventureWorks\snapshots\snapshot-post-release.json" -reportFilename="flyway_consolidated_reports.html"

# Alternative run using snapshots with relative paths (portable version)
flyway info check -changes -drift -code -dryrun -environment="production" -deployedSnapshot=".\snapshots\snapshot-pre-release.json" -nextSnapshot=".\snapshots\snapshot-post-release.json" -reportFilename="flyway_consolidated_reports.html"