migrations

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(options ...Option) error

Applies migration options like setting the folder for migrations.

func Folder

func Folder() string

Returns the folder for migrations

func New

func New(name string) instance

Generates a new migration with the passed name and applies current timestamp to it.

func Template

func Template() string

Returns the template for migrations.

Types

type Migrator

type Migrator interface {
	// Setup the database, p.e. creating the migrations table.
	Setup() error
	// Run specific migration timestamp and SQL.
	Run(timestamp, sql string) error
}

Migrator that can take care of migration operations depending on the database.

type Option

type Option func() error

migrationOptions are the options for the migration

func UseMigrationFolder

func UseMigrationFolder(f string) Option

UseMigrationFolder sets the folder for migrations

Jump to

Keyboard shortcuts

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