libmigration

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

README

libmigration

reused bun migration functions

Documentation

Index

Constants

View Source
const (
	CreatingColumn    = "creating column '%s' in Table `%s`"
	CreatingColumnErr = "can't create column '%s' in Table `%s`: %s"
	DroppingColumn    = "dropping column '%s' in Table `%s`"
	DroppingColumnErr = "can't drop column '%s' in Table `%s`: %s"
	CreatingIndex     = "creating index '%s' in Table `%s`"
	CreatingIndexErr  = "can't create index '%s' in Table `%s`: %s"
	DroppingIndex     = "dropping index '%s' in Table `%s`"
	DroppingIndexErr  = "can't drop index '%s' in Table `%s`: %s"
	CreatingTable     = "creating Table '%s'"
	CreatingTableErr  = "can't create Table '%s': %s"
	DroppingTable     = "dropping Table '%s'"
	DroppingTableErr  = "can't drop Table '%s': %s"
)

Variables

This section is empty.

Functions

func AddColumnsDown

func AddColumnsDown(ctx context.Context, l *logrus.Entry, tx bun.Tx, columns ColumnList) error

func AddColumnsUp

func AddColumnsUp(ctx context.Context, l *logrus.Entry, tx bun.Tx, columns ColumnList) error

func AddIndexesDown

func AddIndexesDown(ctx context.Context, l *logrus.Entry, tx bun.Tx, indexes IndexList) error

func AddIndexesUp

func AddIndexesUp(ctx context.Context, l *logrus.Entry, tx bun.Tx, indexes IndexList) error

func AddTablesDown

func AddTablesDown(ctx context.Context, l *logrus.Entry, tx bun.Tx, tables TableList) error

func AddTablesUp

func AddTablesUp(ctx context.Context, l *logrus.Entry, tx bun.Tx, tables TableList) error

Types

type Column

type Column struct {
	Model interface{}
	Name  string
	Type  string

	Default interface{}
	NotNull bool
}

type ColumnList

type ColumnList []Column

type Index

type Index struct {
	Model   interface{}
	Name    string
	Columns []string
	Unique  bool
}

type IndexList

type IndexList []Index

type Table

type Table struct {
	Model       interface{}
	ForeignKeys []string
	IfNotExists bool
}

type TableList

type TableList []Table

Jump to

Keyboard shortcuts

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