migrate

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package migrate provides migrate utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts Options) (ports.Migrator, error)

New builds an Adapter and pings the database.

func NewWithContext

func NewWithContext(ctx context.Context, opts Options) (ports.Migrator, error)

NewWithContext builds an Adapter and pings the database with a context.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter implements runtime.Migrator using migrator.Runner.

func (*Adapter) Close

func (a *Adapter) Close() error

Close releases the underlying database handle.

func (*Adapter) Down

func (a *Adapter) Down(ctx context.Context, _ string) error

Down rolls back migrations.

func (*Adapter) Status

func (a *Adapter) Status(ctx context.Context, _ string) (string, error)

Status returns the current migration status.

func (*Adapter) Up

func (a *Adapter) Up(ctx context.Context, _ string) error

Up applies migrations.

type Options

type Options struct {
	DSN                string
	Dirs               []string // optional; multiple directories
	Table              string
	LockKey            int64
	AllowDangerousDown bool
	EmbeddedFSs        []fs.FS // optional; multiple embedded FS
	Log                ports.Logger
}

Options configures migrator initialization.

Jump to

Keyboard shortcuts

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