Skip to content

Commit

Permalink
Refactor Flyway Command-Line main method
Browse files Browse the repository at this point in the history
Closes #3664: Bump Snowflake JDBC to 3.13.30 @sseide
Bump SQLite JDBC to 3.41.2.1 to address CVE-2021-20227, CVE-2022-35737 and CVE-2022-46908 @sseide
Bump MariaDB JDBC to 2.7.9 to address multiple issues @sseide
Closes #3648: Ensure Flyway uses ALL_CREDENTIALS when using versions of Oracle where ALL_SCHEDULER_CREDENTIALS is deprecated
update version of msal4j to fix vulnerability
allow escaped single quotes in SQL string literals
Closes #3621: allow escaped single quotes in SQL string literals
Update version of snowflake-jdbc to fix SNYK-JAVA-NETSNOWFLAKE-5425048
Remove redundant edition flags documentation
Remove migrations testing tutorial
Adding Flyway Reports; Single file HTML reports that expose important details and stats about your Flyway pipeline in an easy to read and share format.
Closes #3652: Remove redundant html extension on automatically generated reports and empty reports
add direct support for Alpine linux
  • Loading branch information
Barry-RG committed Apr 27, 2023
1 parent 8e3af28 commit 60a5ad1
Show file tree
Hide file tree
Showing 126 changed files with 2,780 additions and 1,028 deletions.
12 changes: 1 addition & 11 deletions documentation/Flyway CLI and API/Commands/Check.md
Expand Up @@ -32,7 +32,7 @@ You can read more about the `check` concept [here](Concepts/Check Concept).
| check.buildUrl | changes, drift | URL for a build database.
| check.buildUser | changes, drift | Username for the build database. Defaults to 'flyway.user'
| check.buildPassword | changes, drift | Password for the build database. Defaults to 'flyway.password'
| check.reportFilename | all | **[REQUIRED]** Destination filename for reports
| check.reportFilename | all | **[DEPRECATED]** Destination filename for reports. Please use [`reportFilename`](Configuration/Parameters/Report Filename) instead.
| check.nextSnapshot | changes, drift | A snapshot containing all migrations including those that are pending (generated via [`snapshot`](Commands/snapshot))
| check.deployedSnapshot | changes, drift | A snapshot containing all applied migrations and thus matching what should be in the target (generated via [`snapshot`](Commands/snapshot))
| check.appliedMigrations | changes, drift | A comma-separated list of migration ids (migration versions or repeatable descriptions) to apply to create snapshots (generated via [`info`](Commands/info))
Expand All @@ -42,23 +42,13 @@ You can read more about the `check` concept [here](Concepts/Check Concept).
| check.majorTolerance | code | The number of 'major' issues to be tolerated before throwing an error, see [Check Concept](Concepts/Check Concept)
| check.minorTolerance | code | The number of 'minor' issues to be tolerated before throwing an error, see [Check Concept](Concepts/Check Concept)

#### `check.reportFilename`

If this filename does not have the `.html` suffix, Flyway will add it for you. Flyway also produces a `json` result for programmatic consumption.

#### Usage Example:
```
flyway check -changes -url=jdbc:example:database -user=username -password=password -check.buildUrl=jdbc:example:build_database
```

##### Example configuration file

```properties
flyway.url=jdbc:example:database
flyway.user=username
flyway.password=password
flyway.check.buildUrl=jdbc:example:build_database
flyway.check.reportFilename=change_report
```

#### Database Support
Expand Down
5 changes: 5 additions & 0 deletions documentation/Flyway CLI and API/Commands/Info.md
Expand Up @@ -12,3 +12,8 @@ which other ones are still pending, when they were executed and whether they wer

## Usage
{% include commandUsage.html command="Info" %}


## Learn More

* [Info Report](Reports/Reports - Info)
4 changes: 4 additions & 0 deletions documentation/Flyway CLI and API/Commands/Migrate.md
Expand Up @@ -28,3 +28,7 @@ Migrate does nothing.

## Usage
{% include commandUsage.html command="Migrate" %}

## Learn More

* [Migration Report](Reports/Reports - Migration)
10 changes: 5 additions & 5 deletions documentation/Flyway CLI and API/Concepts/Check concept.md
Expand Up @@ -59,7 +59,7 @@ The process works like this:
1. This is the database you want to apply your changes to, where Flyway is already being used to manage migrations (ie. A Flyway migrations table exists)
1. Specify a build database
1. This is an existing build database (note: Flyway will [`clean`](Commands/clean) this database, so if you specify a full database, you must ensure it is ok to for Flyway to erase its schema)
1. Run `flyway check -changes -check.buildUrl="jdbc://build-url" -url="jdbc://url" -check.reportFilename="changeReport.html"`
1. Run `flyway check -changes -check.buildUrl="jdbc://build-url" -url="jdbc://url"`

Flyway's `check -changes` will then:
1. Clean your build database
Expand All @@ -83,7 +83,7 @@ The process works like this:
1. This will produce a comma-separated list which represents the applied migrations of your target database
1. Specify a build database
1. This is an existing build database (note: Flyway will [`clean`](Commands/clean) this database, so if you specify a full database, you must ensure it is ok to for Flyway to erase its schema)
1. Run `flyway check -changes -check.buildUrl="jdbc://build-url" -check.appliedMigrations="$(cat appliedMigrations.txt)" -check.reportFilename="changeReport.html"`
1. Run `flyway check -changes -check.buildUrl="jdbc://build-url" -check.appliedMigrations="$(cat appliedMigrations.txt)"`

Flyway's `check -changes` will then:
1. Clean your build database
Expand Down Expand Up @@ -119,7 +119,7 @@ The process works like this:
1. This is the database you want to apply your changes to, where Flyway is already being used to manage migrations (ie. A Flyway migrations table exists)
1. Specify a build database
1. This is an existing build database (note: Flyway will "clean" this database, so if you specify a full database, you must ensure it is ok to for Flyway to erase its schema)
1. Run `flyway check -drift -check.buildUrl="jdbc://build-url" -url="jdbc://url" -check.reportFilename="driftReport.html"`
1. Run `flyway check -drift -check.buildUrl="jdbc://build-url" -url="jdbc://url"`

Flyway's `check -drift` will then:
1. Take a [`snapshot`](Commands/snapshot) of the target database
Expand Down Expand Up @@ -171,7 +171,7 @@ This will produce a report in your terminal.
In Flyway Teams, you can run:

```
flyway check -code -check.reportFilename=report.html -url=jdbc:postgresql://...
flyway check -code -url=jdbc:postgresql://...
```

This will run SQLFluff under the hood, and produce a HTML and JSON report that you can use to check the standards of your migrations.
Expand Down Expand Up @@ -210,4 +210,4 @@ For example:
./flyway check -code '-check.majorTolerance=3' '-check.majorRules=L034,L042'
```

This will fail if rules `L034` and `L042` are violated 4 or more times in total across all scanned migration scripts.
This will fail if rules `L034` and `L042` are violated 4 or more times in total across all scanned migration scripts.
4 changes: 4 additions & 0 deletions documentation/Flyway CLI and API/Concepts/Migrations.md
Expand Up @@ -530,3 +530,7 @@ The following will happen:
| `Out of Order` | This migration succeeded but it was applied out of order. Rerunning the entire migration history might produce different results! |
| `Outdated` | This is a [`repeatable`](Tutorials/Tutorial Repeatable Migrations) migration that is outdated and should be re-applied |
| `Superseded` | This is a [`repeatable`](Tutorials/Tutorial Repeatable Migrations) migration that is outdated and has already been superseded by a newer one |

## Learn More

* [Migration Report](Reports/Reports - Migration)

This file was deleted.

@@ -0,0 +1,38 @@
---
pill: reportFilename
subtitle: flyway.reportFilename
---

# Report Filename

## Description
Filename for the report file. The report is a html file containing the details of the migration including SQL script execution times and success/failure statuses as well as the results of `check`.
This filename will also be used for a supplementary json file as well, excluding any html or htm extension.


## Default
report.html

## Usage

### Commandline
```powershell
./flyway -reportFilename=flyway_report.html info
```

### Configuration File
```properties
flyway.reportFilename=flyway_report.html
```

### Environment Variable
```properties
FLYWAY_REPORT_FILENAME=flyway_report.html
```

## Notes
This parameter replaces the deprecated `flyway.check.reportFilename` parameter.
If you are using `check`, `flyway.check.reportFilename` will overwrite `flyway.reportFilename` for all reports.
If you are not using `check`, `flyway.check.reportFilename` will be ignored.

Empty `reportFilename` will be replaced by the default value.
Expand Up @@ -48,37 +48,33 @@ Unfortunately these are not available through Maven Central and must be added ma
repository.

Download the v17 JRE package suitable for your OS files from the [Adoptium website](https://adoptium.net/temurin/releases/?version=17):
and place them in your local maven repository as (_Note: your precise version may be newer_):

- `~/.m2/repository/net/adoptopenjdk/jre/17.0.5/jre-17.0.5-windows-x64.zip`
- `~/.m2/repository/net/adoptopenjdk/jre/17.0.5/jre-17.0.5-linux-x64.tar.gz`
- `~/.m2/repository/net/adoptopenjdk/jre/17.0.5/jre-17.0.5-macos-x64.tar.gz`
and place them in your local directory.

by invoking:

<pre class="console">mvn install:install-file -DgroupId=net.adoptopenjdk \
-DartifactId=jre \
-Dclassifier=windows-x64 \
-Dtype=zip \
-Dversion=17.0.5 \
-Dversion=17.0.6 \
-Dpackaging=zip \
-Dfile=path/to/OpenJDK17U-jre_x64_windows_hotspot_17.0.5_9.zip</pre>
-Dfile=path/to/OpenJDK17U-jre_x64_windows_hotspot_17.0.6_10.zip</pre>

<pre class="console">mvn install:install-file -DgroupId=net.adoptopenjdk \
-DartifactId=jre \
-Dclassifier=linux-x64 \
-Dtype=tar.gz \
-Dversion=17.0.5 \
-Dversion=17.0.6 \
-Dpackaging=tar.gz \
-Dfile=path/to/OpenJDK17U-jre_x64_linux_hotspot_17.0.5_9.tar.gz</pre>
-Dfile=path/to/OpenJDK17U-jre_x64_linux_hotspot_17.0.6_10.tar.gz</pre>

<pre class="console">mvn install:install-file -DgroupId=net.adoptopenjdk \
-DartifactId=jre \
-Dclassifier=macos-x64 \
-Dtype=tar.gz \
-Dversion=17.0.5 \
-Dversion=17.0.6 \
-Dpackaging=tar.gz \
-Dfile=path/to/OpenJDK17U-jre_x64_mac_hotspot_17.0.5_9.tar.gz</pre>
-Dfile=path/to/OpenJDK17U-jre_x64_mac_hotspot_17.0.6_10.tar.gz</pre>

<p class="next-steps">
<a style="text-decoration: none; background: rgb(204,0,0); padding: 6px 40px; border-radius: 10px; color: white; font-weight: bold;" href="Contribute/Code/Code - Submit your Changes">Submit your changes <i class="fa fa-arrow-right"></i></a>
Expand Down
7 changes: 7 additions & 0 deletions documentation/Flyway CLI and API/Reports.md
@@ -0,0 +1,7 @@
---
subtitle: placeholder page
---
Flyway produces reporting of activity outcome - this section describes the nature of the report and how you could use it.
<div id="children">
{% include childPages.html %}
</div>
17 changes: 17 additions & 0 deletions documentation/Flyway CLI and API/Reports/Reports - Change.md
@@ -0,0 +1,17 @@
---
subtitle: Change Report
---
{% include enterprise.html %}

The change report indicates the difference between applied migration scripts on your target database and pending migrations scripts (ie. the set of instructions you want to use to change your target database).

You might want this to:

* Pre-deployment - check the effect of your pending changes (DBA review)
* Post-deployment -capture a history of changes for retrospective auditing or reporting

## Learn more
* [Check concept](Concepts/Check Concept) - how does it work ?
* [Check command](Commands/Check) - What is the command structure ?
* [Tutorial - Using Flyway Check](Tutorials\Tutorial - Using Flyway Check with SQL Server.md) - how do I use it ?
* Get a [Flyway Enterprise Trial](https://www.red-gate.com/products/flyway/enterprise/trial/)
@@ -0,0 +1,15 @@
---
subtitle: Code Analysis
---

The code analysis report shows you the results of the static analysis tool(s) that Flyway integrates with.
* An integration with [SQlFluff](https://www.sqlfluff.com/) exists for all editions
* Teams customers can configure how their pipeline can be halted based on policy around rule violations
* Enterprise customers also get an easy mechanism to create and use custom rules based on regex pattern matching

## Learn more

* [Check concept](Concepts/Check Concept) - how does it work ?
* [Check command](Commands/Check) - What is the command structure ?
* [Flyway Teams Edition](https://www.red-gate.com/products/flyway/teams/)
* Get a [Flyway Enterprise Trial](https://www.red-gate.com/products/flyway/enterprise/trial/)
16 changes: 16 additions & 0 deletions documentation/Flyway CLI and API/Reports/Reports - Drift.md
@@ -0,0 +1,16 @@
---
subtitle: Drift Report
---
{% include enterprise.html %}

The drift report indicates the differences between structure of your target database and structure created by the migrations applied by Flyway.

You might want this to:
* Check if changes have been made to your database outside of the Flyway migration control mechanism
* The target database is in the state you expect it t be in prior to applying new migrations

## Learn more

* [Check concept](Concepts/Check Concept) - how does it work ?
* [Check command](Commands/Check) - What is the command structure ?
* Get a [Flyway Enterprise Trial](https://www.red-gate.com/products/flyway/enterprise/trial/)
18 changes: 18 additions & 0 deletions documentation/Flyway CLI and API/Reports/Reports - Dry Run.MD
@@ -0,0 +1,18 @@
---
subtitle: Dry Run Report
---
{% include teams.html %}

Flyway Dry Run lets you preview the SQL that Flyway would execute on your DB based on the migration state of the DB, the pending migrations and the way you have configured Flyway.

You might want this to:

* preview the changes Flyway will make to the database
* submit the SQL statements for review to a DBA before applying them
* use Flyway to determine what needs updating, yet use a different tool to apply the actual database changes

## Learn More

* [Dry Run Concept](Concepts/Dry Runs) - how does it work ?
* [Dry Run Tutorial](Tutorials/Tutorial - Dry Runs) - how do I use it ?
* Get a [Flyway Teams Trial](https://www.red-gate.com/products/flyway/teams/trial/)
16 changes: 16 additions & 0 deletions documentation/Flyway CLI and API/Reports/Reports - Info.md
@@ -0,0 +1,16 @@
---
subtitle: Info Report
---

Shows the details and status information about all the migrations that Flyway knows about.
Info lets you know where you stand. At a glance you will see which migrations have already been applied, which other ones are still pending, when they were executed and whether they were successful or not.

You might want this to:

* Check the current migration state of your target DB
* Understand what is yet to be deployed in a more digestible format than the raw filenames

## Learn More

* [Info](Commands/info)
* Find out about [Flyway Editions](https://www.red-gate.com/products/flyway/editions)
17 changes: 17 additions & 0 deletions documentation/Flyway CLI and API/Reports/Reports - Migration.md
@@ -0,0 +1,17 @@
---
subtitle: Migration Report
---

Database migration is the core of what Flyway does, it takes a set of sequenced changes (migrations), applies them to your database and keeps track of what happened and when.

You might want this to:

* Have a record of what happened when for audit or reporting purposes
* Understand and be able to communicate failures in a more richly descriptive manner

## Learn More

* [Migrate Command](Commands/Migrate) - how does it work ?
* [Migrate - CLI reference](Usage/Command-line/Command-line - Migrate) - What is the command structure ?
* [First Steps: Command-line](Getting Started/First Steps/First Steps - Command-line) - how do I use it ?
* Find out about [Flyway Editions](https://www.red-gate.com/products/flyway/editions)
Expand Up @@ -153,6 +153,7 @@ The following commands are fully supported and can be used just like any regular
- `START` (only files, no URLs)
- `UNDEFINE`
- `WHENEVER SQLERROR CONTINUE`
- `WHENEVER SQLERROR EXIT`
- `WHENEVER SQLERROR EXIT FAILURE`
- `WHENEVER SQLERROR EXIT SQL.SQLCODE`

Expand Down
Expand Up @@ -7,7 +7,7 @@ redirect_from:
---
# Tutorial: Callbacks

This tutorial assumes you have successfully completed the [**First Steps: Command-line**](Getting Started/First Steps/First Steps - Command-line.md)
This tutorial assumes you have successfully completed the [**First Steps: Command-line**](Getting Started/First Steps/First Steps - Command-line)
tutorial. **If you have not done so, please do so first.** This tutorial picks up where that one left off.

This brief tutorial will teach **how to use callbacks**. It will take you through the
Expand All @@ -25,7 +25,7 @@ They are typically used for

## Reviewing the status

After having completed the [First Steps: Command-line](Getting Started/First Steps/First Steps - Command-line.md), you can now execute
After having completed the [First Steps: Command-line](Getting Started/First Steps/First Steps - Command-line), you can now execute

<pre class="console"><span>flyway-{{ site.flywayVersion }}&gt;</span> flyway <strong>info</strong></pre>

Expand Down
Expand Up @@ -7,7 +7,7 @@ redirect_from:
# Tutorial: Dry Runs
{% include teams.html %}

This tutorial assumes you have successfully completed the [**First Steps: Command-line**](Getting Started/First Steps/First Steps - Command-line.md)
This tutorial assumes you have successfully completed the [**First Steps: Command-line**](Getting Started/First Steps/First Steps - Command-line)
tutorial. **If you have not done so, please do so first.** This tutorial picks up where that one left off.

This brief tutorial will teach **how to do Dry Runs**. It will take you through the
Expand All @@ -29,7 +29,7 @@ directly to the database without using Flyway. This SQL file also contains the n

## Reviewing the status

After having completed the [First Steps: Command-line](Getting Started/First Steps/First Steps - Command-line.md), you can now execute
After having completed the [First Steps: Command-line](Getting Started/First Steps/First Steps - Command-line), you can now execute

<pre class="console"><span>flyway-{{ site.flywayVersion }}&gt;</span> flyway <strong>info</strong></pre>

Expand Down

0 comments on commit 60a5ad1

Please sign in to comment.