migrate

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidName reports an invalid migration name.
	ErrInvalidName = errors.New("invalid migration name")
)

Functions

func Create

func Create(ctx context.Context, opts CreateOptions) error

Create creates a timestamped Go migration file under db/migrations.

func Down

func Down(ctx context.Context, opts Options) error

Down rolls back the latest applied migration.

func Status

func Status(ctx context.Context, opts Options) error

Status prints all discovered migrations and their applied/pending state. If no database is configured, all migrations are shown as pending.

func Up

func Up(ctx context.Context, opts Options) error

Up applies all pending migrations in chronological order.

Types

type CreateOptions

type CreateOptions struct {
	RootDir string
	Name    string
	Now     func() time.Time
}

CreateOptions configures migration file creation.

type Options

type Options struct {
	RootDir     string
	DatabaseURL string
	Output      io.Writer
}

Options configures migration status and execution commands.

Jump to

Keyboard shortcuts

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