migrate

package
v0.0.0-...-5e24856 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(migrationsFs fs.ReadDirFS) (migrations []db.Migration, err error)

Load all the migrations files for the given FS

func Migrate

func Migrate(ctx context.Context, db db.DB, migrations []Migration) (err error)

func Rollback

func Rollback(ctx context.Context, db db.DB, migrations []Migration, numberToRollback int64) (err error)

Rollback undo the latest migration

Types

type Migration

type Migration struct {
	ID   int64
	Up   func(ctx context.Context, tx db.Queryer) (err error)
	Down func(ctx context.Context, tx db.Queryer) (err error)
}

Jump to

Keyboard shortcuts

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