migrations

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DBDriver            DBDriver
	Addr                string
	DBName              string
	User                string
	Password            string
	DisableConfirmation bool
}

func (Config) Validate

func (c Config) Validate() error

type DBDriver

type DBDriver string
const (
	DBDriverPostgres DBDriver = "postgres"
	DBDriverMySQL    DBDriver = "mysql"
)

func (DBDriver) Valid

func (d DBDriver) Valid() bool

Valid checks if the DBDriver is valid.

type Migration

type Migration struct {
	// contains filtered or unexported fields
}

func New

func New(l initLogger, conf Config) (*Migration, error)

func (*Migration) Down

func (s *Migration) Down(ctx context.Context, steps int) error

Down rolls back the database schema by the specified number of steps.

func (*Migration) Drop

func (s *Migration) Drop(ctx context.Context) error

Drop removes all database schema.

func (*Migration) Up

func (s *Migration) Up(ctx context.Context, steps int) error

Up applies the database schema by the specified number of steps.

func (*Migration) Version

func (s *Migration) Version(ctx context.Context) (uint, bool, error)

Version returns the current database schema version.

Jump to

Keyboard shortcuts

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