migrator

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: 0 Imported by: 0

Documentation

Overview

Package migrator provides migration runners in subpackages. Use the one that matches your migration layout

goose (migrator/goose)

Run(ctx, connStr, migrationsPath) runs pressly/goose "up" migrations. SQL files use +goose Up/Down directives connStr and migrationsPath must be non-empty. migrationsPath is cleaned with filepath.Clean and should be under application control (not user input). ctx is used for cancellation. RunFS(ctx, connStr, migrationsFS) runs the same goose provider from fs.FS, which is useful for go:embed migration files

migrate (migrator/migrate)

Run(ctx, connURL, migrationsPath) runs golang-migrate "up" from file://migrationsPath. Expects separate .up.sql and .down.sql files. connURL and migrationsPath must be non-empty. migrationsPath is cleaned and should be under application control. ErrNoChange is ignored. RunOptions accepts explicit statement and lock timeouts

Directories

Path Synopsis
Package goose provides PostgreSQL migrations using pressly/goose
Package goose provides PostgreSQL migrations using pressly/goose
Package migrate provides PostgreSQL migrations using golang-migrate
Package migrate provides PostgreSQL migrations using golang-migrate

Jump to

Keyboard shortcuts

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