Redgate Flyway

Snapshot

Description

Flyway Enterprise

Generates a snapshot from a database environment, build environment, schema snapshot folder or empty source. A snapshot captures the schema of a specified source into a file for subsequent use with the Check Changes command, Check Drift command, Snapshot command or Snapshot provisioner.

Be sure to set environment schemas when generating a snapshot for Oracle databases.

See Snapshots for more information.

Usage examples

Generating a snapshot from a database URL

flyway snapshot -url=jdbc:sqlserver://localhost:1433;encrypt=false;databaseName=Inventory -user=sa -password=... -filename=C:\snapshot.json

Generating a snapshot from a database environment

if a database environment named dev is configured in the flyway.toml file, then the environment name can be provided as a CLI argument instead of passing the connection details as CLI arguments.

flyway snapshot -source=dev -filename=C:\snapshot.json

Generating a snapshot from a schema snapshot folder

flyway snapshot -source=schemaSnapshot -filename=C:\snapshot.json

Generating a snapshot using the build database

flyway snapshot -source=migrations -buildEnvironment=shadow -buildVersion=2 -filename=C:\snapshot.json

The snapshot.build* arguments make it possible to create a snapshot for any migration version.

Parameters

Required

Parameter Namespace Description
filename snapshot Destination filename for the snapshot.

Optional

Parameter Namespace Description
source snapshot The source from which a snapshot should be generated.
buildEnvironment snapshot If source is migrations, this specifies the environment to use as the build environment.
buildVersion snapshot If source is migrations, this specifies migration version to migrate the build environment to.
buildCherryPick snapshot If source is migrations, this specifies list of migrations to migrate the build environment with.
rebuild snapshot If source is migrations, forces a reprovision (rebuild) of the build environment.
schemaModelLocation (root) The path to the schema model.
schemaModelSchemas (root) The schemas in the schema model.
workingDirectory (root) The directory to consider the current working directory. All relative paths will be considered relative to this.
{environment parameters} (root) Environment configuration for the source environment.

Universal commandline parameters are listed here.

Settings from the following sections of the Flyway namespace can be specified in relation to database connections:

  • General settings
  • Settings in database-specific namespaces
  • Settings in secrets management namespaces

When the source is migrations, settings from the following sections of the Flyway namespace can also be set:

  • Migration location and naming settings
  • Migration reading settings
  • Migration execution settings
  • Flyway schema history settings
  • Placeholders

JSON output format

{
  "filename": "C:\snapshot.json"
}

Didn't find what you were looking for?