migrations

package
v2.27.3 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: AGPL-3.0 Imports: 18 Imported by: 1 module, 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 CheckLatestVersion

func CheckLatestVersion(sourceDriver source.Driver, currentVersion uint) error

Returns nil if currentVersion corresponds to the latest available migration, otherwise an error explaining why not.

func Down

func Down(db *sql.DB) error

Down runs all down SQL migrations.

func EnsureClean

func EnsureClean(db *sql.DB) error

EnsureClean checks whether all migrations for the current version have been applied, without making any changes to the database. If not, returns a non-nil error.

func GetMigrationsHash added in v2.18.0

func GetMigrationsHash() string

func Stepper

func Stepper(db *sql.DB) (next func() (version uint, more bool, err error), err error)

Stepper returns a function that runs SQL migrations one step at a time.

Stepper cannot be closed pre-emptively, it must be run to completion (or until an error is encountered).

func Up

func Up(db *sql.DB) error

Up runs SQL migrations to ensure the database schema is up-to-date.

func UpWithFS added in v2.11.0

func UpWithFS(db *sql.DB, migs fs.FS) (retErr error)

UpWithFS runs SQL migrations in the given fs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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