flyway

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

README

Flyway Test Container

This component creates and runs a flyway container which will, given a set of valid migrations, migrate the associated database (see tests for a postgres example) to a known database revision.

To use this component you must do the following in order

  • create & run a network container : a network which enables the flyway container to connect to the database
  • create & run a database container : contains the database to be migrated, references the network above
  • create & run a flyway container (this container) : configured to specify the necessary flyway migrations, uses the network above

NOTE: this will only migrate the database, it will not insert data in that database, unless the migrations themselves contains data inserts of course.

Please refer to the https://flywaydb.org/ site for more information on flyway itself.

Please refer to the examples folder for tests & examples of using a flyway testcontainer with a real database e.g.

How to make stuff

  • make install : will install any dependencies needed to lint and test this module
  • make test : will test this module

Documentation

Index

Constants

View Source
const (
	DefaultVersion        = "10.15.0"
	DefaultMigrationsPath = "/flyway/sql"
)

Variables

This section is empty.

Functions

func BuildFlywayImageVersion

func BuildFlywayImageVersion(version ...string) string

func WithConnectRetries

func WithConnectRetries(retries int) testcontainers.CustomizeRequestOption

func WithMigrations

func WithMigrations(absHostFilePath string) testcontainers.CustomizeRequestOption

func WithPassword

func WithPassword(password string) testcontainers.CustomizeRequestOption

Types

type FlywayContainer

type FlywayContainer struct {
	testcontainers.Container
}

FlywayContainer represents the Flyway container type used in the module

func RunContainer

RunContainer creates an instance of the Flyway container type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL