migrate

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package migrate provides PostgreSQL migrations using golang-migrate

Index

Constants

View Source
const (
	DefaultStatementTimeout = 5 * time.Minute
	DefaultLockTimeout      = 15 * time.Second
)

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, connURL, migrationsPath string) error

Run runs golang-migrate "up" from file://migrationsPath using connURL. ErrNoChange is ignored. connURL and migrationsPath must be non-empty. migrationsPath is cleaned and should be under application control (not user input).

func RunOptions added in v1.4.0

func RunOptions(ctx context.Context, connURL, migrationsPath string, opts Options) (err error)

RunOptions runs golang-migrate "up" with explicit execution bounds. Zero timeouts use DefaultStatementTimeout and DefaultLockTimeout; negative values are rejected.

Types

type Options added in v1.4.0

type Options struct {
	// StatementTimeout bounds each migration SQL statement. Zero uses DefaultStatementTimeout.
	StatementTimeout time.Duration
	// LockTimeout bounds golang-migrate advisory lock acquisition. Zero uses DefaultLockTimeout.
	LockTimeout time.Duration
}

Options controls migrate.RunOptions.

Jump to

Keyboard shortcuts

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