mig

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 8 Imported by: 0

README

[!WARNING] This package is still in development and is not yet ready for use.

mig

Go Reference

Database migration framework for Go

Installation

go get github.com/cprosche/mig

License

MIT

Documentation

Index

Constants

View Source
const (
	DEFAULT_UP_DELIMITER   = "-- up"
	DEFAULT_DOWN_DELIMITER = "-- down"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Db is the database connection used for migrations
	Db *sql.DB

	// Fs is the filesystem where the migrations are stored
	Fs              fs.FS
	OverrideDirName string

	// If Fs is nil, then this slice of migrations will be used
	Migrations []Migration

	// Delimiters for splitting up and down migrations in a single file
	UpDelimiter   string
	DownDelimiter string
}

Config is the configuration for Mig

type Mig

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

Mig is the main struct for the mig package

func New

func New(c Config) (*Mig, error)

func (*Mig) Migrate

func (mig *Mig) Migrate() error

type Migration

type Migration struct {
	Id       int
	FileName string

	Up   string
	Down string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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