migrate

package
v0.0.0-...-d364ca2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package migrate applies readable PostgreSQL migrations through Soro transactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Migration

type Migration struct {
	Name string
	Up   []string
	Down []string
}

func LoadDir

func LoadDir(directory string) ([]Migration, error)

LoadDir loads convention-based .sql migrations in lexical filename order.

func LoadFile

func LoadFile(path string) (Migration, error)

LoadFile parses one migration with explicit Soro Up and Down sections.

type Migrator

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

func New

func New(db *database.DB) *Migrator

func (*Migrator) Apply

func (m *Migrator) Apply(ctx context.Context, migrations []Migration) error

func (*Migrator) Rollback

func (m *Migrator) Rollback(ctx context.Context, migrations []Migration, count int) error

func (*Migrator) Status

func (m *Migrator) Status(ctx context.Context, migrations []Migration) ([]Status, error)

type Status

type Status struct {
	Name      string
	Applied   bool
	AppliedAt *time.Time
}

Jump to

Keyboard shortcuts

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