migrations

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeMigrationHash

func ComputeMigrationHash(str string) string

ComputeMigrationHash computes the md5 hash of a migration file

Types

type File

type File struct {
	Migrations []struct {
		Path string `yaml:"path"`
		Hash string `yaml:"hash"`
	}
}

File is used to parse a database manifest: a single ordered list of every migration in the database, each entry a "{directory}/{filename}" path. This is the total ordering of the database's migrations.

type FileLoader

type FileLoader func(string) ([]byte, error)

FileLoader loads a file and returns bytes.

type Migration

type Migration struct {
	Directory          string    `db:"directory"`
	Filename           string    `db:"filename"`
	Hash               string    `db:"hash"`
	ExecutionTimestamp time.Time `db:"execution_timestamp"`
	SQLQuery           string
	ExpectedHash       string
}

Migration is the database representation of migration.

func GetMigrations

func GetMigrations(fileLoader FileLoader, databaseDirectory string) ([]*Migration, error)

GetMigrations loads every migration listed in a database manifest, preserving the order in which they are declared.

func (*Migration) Name

func (m *Migration) Name() string

Name returns a "{directory}:{filename}" string for clear/consistent logging.

Jump to

Keyboard shortcuts

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