migration

package
v0.0.0-...-a974e34 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToApplyMigrations = errors.New("failed to apply migrations")
	ErrMissedDBConnection      = errors.New("missed db connection")
	ErrUndefinedDBDriver       = errors.New("undefined db driver")
)

Predefined errors.

Functions

func Down

func Down(db *sql.DB, driver, migrationsTable, migrationsDir string) (int, error)

Down rolls back all migrations.

func Run

func Run(db *sql.DB, driver, migrationsTable, migrationsDir string, direction migrate.MigrationDirection) (int, error)

Run executes database migrations using the provided parameters. It takes a *sql.DB object, the database driver name, the name of the migrations table, the directory containing the migration files, and the migration direction. It returns the number of applied migrations and any error encountered.

func Up

func Up(db *sql.DB, driver, migrationsTable, migrationsDir string) (int, error)

Up applies all available migrations.

Types

This section is empty.

Jump to

Keyboard shortcuts

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