migrate

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package migrate provides database migration functionality using golang-migrate. Migration files are embedded and tracked in a schema_migrations table.

Index

Constants

This section is empty.

Variables

Functions

func Run

func Run(db *sql.DB, migrationFS fs.FS) error

Run executes all pending database migrations from the embedded filesystem. Only migrations that haven't been applied yet will run. Returns an error if the database is in a dirty state or if any migration fails.

func RunTest

func RunTest(t interface {
	Helper()
	Fatalf(format string, args ...any)
}, db *sql.DB,
)

RunTest is a helper for running migrations in tests. It wraps Run and fails the test on error.

func Status

func Status(db *sql.DB, migrationFS fs.FS) (version uint, dirty bool, err error)

Status returns the current migration version and dirty state. A dirty state indicates a migration failed partway through and needs manual intervention.

Types

This section is empty.

Jump to

Keyboard shortcuts

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