Help us shape the future of Go! Take the 2026 Go Developer Survey

migrationsutils

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTableColumnNames

func GetTableColumnNames(db *sql.DB, tableName string) ([]string, error)

func TestMigration

func TestMigration(t *testing.T, dbName string, migrationData []types.Migration,
	migrationNumber int, miter MigrationTester)

Types

type MigrationTester

type MigrationTester interface {
	// FilenameTemplateDatabase returns the template for the database filename
	// if it's empty create a new one, if not copy this to a temporary file
	FilenameTemplateDatabase(*testing.T) string
	// InsertData used to insert data in the affected tables of the migration that is being tested
	// data will be inserted with the schema as it was before the migration that is being tested
	InsertDataBeforeMigrationUp(*testing.T, *sql.DB)
	// RunAssertsAfterMigrationUp this function will be called after running the migration is being tested
	// and should assert that the data inserted in the function InsertData is persisted properly
	RunAssertsAfterMigrationUp(*testing.T, *sql.DB)
	// RunAssertsAfterMigrationDown this function will be called after reverting the migration that is being tested
	// and should assert that the data inserted in the function InsertData is persisted properly
	RunAssertsAfterMigrationDown(*testing.T, *sql.DB)
}

Jump to

Keyboard shortcuts

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