migrate

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package migrate implements Palma's PostgreSQL SQL-file migration tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(directory, name string) (string, error)

Create reserves one file exclusively. Versions increase independently of the clock.

Types

type Migration

type Migration struct {
	Version                  int64
	Name, Up, Down, Checksum string
}

func Load

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

type State

type State struct {
	Version int64
	Name    string
	Applied bool
}

func Run

func Run(ctx context.Context, db *sql.DB, files []Migration, action string, steps int) (states []State, err error)

Run serializes migration operations on a dedicated PostgreSQL session. Up steps=0 applies all pending files; down steps must be positive. Each file and its history record commit together; earlier successful files remain committed if a later file fails. Status never creates the history table.

Jump to

Keyboard shortcuts

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