migrations

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package migrations reads the migration files of an application and the rows that drel already applied. The CLI prints them, and the boot check of the root package proves that none is pending. See the SDD, S14 and DX-8.

Index

Constants

View Source
const TrackingTable = "drel_migrations"

TrackingTable is the table that drel writes when it applies a migration.

Variables

This section is empty.

Functions

func Applied

func Applied(ctx context.Context, e *drel.Engine) map[string]string

Applied returns the time of each applied migration, keyed by version. A database with no tracking table holds none.

func File

func File(dir string, m Migration, direction string) string

File returns the path of the up file or the down file of a migration.

Types

type Migration

type Migration struct {
	// Version is the fourteen digit version of the file name.
	Version string
	// Name is the part of the file name after the version.
	Name string
}

Migration is one file pair of the migrations directory.

func Pending

func Pending(ctx context.Context, e *drel.Engine, dir string) ([]Migration, error)

Pending returns the migrations that the database does not hold.

func Read

func Read(dir string) ([]Migration, error)

Read returns the migrations of the directory, in version order. An absent directory holds none.

Jump to

Keyboard shortcuts

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