migrate

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(ctx context.Context, dbx *db.DB) error

Migrate runs the migrations.

func Rollback

func Rollback(ctx context.Context, dbx *db.DB) error

Rollback rolls back a migration.

Types

type MigrateFunc

type MigrateFunc func(ctx context.Context, tx *db.Tx) error // nolint:revive

MigrateFunc is a function that executes a migration.

type Migration

type Migration struct {
	Version  int64
	Name     string
	Migrate  MigrateFunc
	Rollback MigrateFunc
}

Migration is a struct that contains the name of the migration and the function to execute it.

type Migrations

type Migrations struct {
	ID      int64  `db:"id"`
	Name    string `db:"name"`
	Version int64  `db:"version"`
}

Migrations is a database model to store migrations.

Jump to

Keyboard shortcuts

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