Help us shape the future of Go! Take the 2026 Go Developer Survey

golangmigrate

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package golangmigrate provides a MigrationDriver backed by golang-migrate/migrate/v4.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver struct{}

Driver implements interfaces.MigrationDriver using golang-migrate.

func New

func New() *Driver

New returns a new golang-migrate Driver.

func (*Driver) Down

Down rolls back N migrations (Options.Steps, default 1).

func (*Driver) Force added in v0.3.2

func (d *Driver) Force(ctx context.Context, req interfaces.MigrationRequest, target string, opts ForceOptions) (result interfaces.MigrationResult, err error)

Force sets the recorded migration version without applying migration files.

func (*Driver) Goto

func (d *Driver) Goto(ctx context.Context, req interfaces.MigrationRequest, target string) (result interfaces.MigrationResult, err error)

Goto migrates to the specified version (up or down).

func (*Driver) Name

func (d *Driver) Name() string

Name returns the driver name.

func (*Driver) RepairDirty added in v0.3.3

RepairDirty verifies a dirty database is at the exact expected version before forcing metadata. With UpIfClean, a clean database runs normal up instead.

func (*Driver) Status

Status returns the current migration version and pending migrations.

func (*Driver) Up

Up applies all pending migrations.

type ForceOptions added in v0.3.2

type ForceOptions struct {
	// AllowClean permits force-setting a database that is not currently dirty.
	// Leave false for normal repair flows so force is limited to dirty states.
	AllowClean bool
}

ForceOptions controls safety checks for metadata-only force repair.

type RepairDirtyOptions added in v0.3.3

type RepairDirtyOptions struct {
	ExpectedDirtyVersion string
	ForceVersion         string
	ThenUp               bool
	UpIfClean            bool
}

RepairDirtyOptions controls a guarded metadata repair for a known dirty migration.

Jump to

Keyboard shortcuts

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