migrate

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package migrate applies ordered SQL migrations and records checksums.

Package migrate provides a small production-oriented SQL migration runner.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialect

type Dialect string
const (
	DialectPostgres Dialect = "postgres"
	DialectMySQL    Dialect = "mysql"
	DialectSQLite   Dialect = "sqlite"
)

type Migration

type Migration struct {
	Version  string
	Name     string
	SQL      string
	Checksum string
}

func FromFS

func FromFS(files fs.FS, root string) ([]Migration, error)

type Runner

type Runner struct {
	DB      *sql.DB
	Dialect Dialect
	Table   string
	Now     func() time.Time
}

func (Runner) Up

func (r Runner) Up(ctx context.Context, migrations []Migration) error

Jump to

Keyboard shortcuts

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