package migrations

Import Path
	github.com/go-pg/migrations/v8 (on go.dev)

Dependency Relation
	imports 20 packages, and imported by one package

Involved Source Files collection.go default.go migrations.go
Package-Level Type Names (total 4, in which 3 are exported)
/* sort exporteds by: | */
(*Collection) DisableSQLAutodiscover(flag bool) *Collection DiscoverSQLMigrations scan the dir for files with .sql extension and adds discovered SQL migrations to the collection. DiscoverSQLMigrations scan the dir from the given filesystem for files with .sql extension and adds discovered SQL migrations to the collection. (*Collection) Migrations() []*Migration (*Collection) MustRegister(fns ...func(DB) error) (*Collection) MustRegisterTx(fns ...func(DB) error) Register registers new database migration. Must be called from a file with name like "1_initialize_db.go". RegisterTx is like Register, but migration will be run in a transaction. (*Collection) Run(db DB, a ...string) (oldVersion, newVersion int64, err error) (*Collection) SetTableName(tableName string) *Collection (*Collection) SetVersion(db DB, version int64) error (*Collection) Version(db DB) (int64, error) func NewCollection(migrations ...*Migration) *Collection func (*Collection).DisableSQLAutodiscover(flag bool) *Collection func (*Collection).SetTableName(tableName string) *Collection var DefaultCollection *Collection
DB is a common interface for pg.DB and pg.Tx types. ( DB) Begin() (*pg.Tx, error) ( DB) Context() context.Context ( DB) CopyFrom(r io.Reader, query interface{}, params ...interface{}) (orm.Result, error) ( DB) CopyTo(w io.Writer, query interface{}, params ...interface{}) (orm.Result, error) ( DB) Exec(query interface{}, params ...interface{}) (orm.Result, error) ( DB) ExecOne(query interface{}, params ...interface{}) (orm.Result, error) ( DB) Model(model ...interface{}) *orm.Query ( DB) Query(coll, query interface{}, params ...interface{}) (orm.Result, error) ( DB) QueryOne(model, query interface{}, params ...interface{}) (orm.Result, error) *github.com/go-pg/pg/v10.Conn *github.com/go-pg/pg/v10.DB *github.com/go-pg/pg/v10.Tx func Run(db DB, a ...string) (oldVersion, newVersion int64, err error) func SetVersion(db DB, version int64) error func Version(db DB) (int64, error) func (*Collection).Run(db DB, a ...string) (oldVersion, newVersion int64, err error) func (*Collection).SetVersion(db DB, version int64) error func (*Collection).Version(db DB) (int64, error)
Down func(DB) error DownTx bool Up func(DB) error UpTx bool Version int64 (*Migration) String() string *Migration : expvar.Var *Migration : fmt.Stringer func RegisteredMigrations() []*Migration func (*Collection).Migrations() []*Migration func go.pact.im/x/old/pgtxtar.LoadFS(fsys fs.FS) ([]*Migration, error) func NewCollection(migrations ...*Migration) *Collection
Package-Level Functions (total 17, in which 10 are exported)
func MustRegister(fns ...func(DB) error)
func MustRegisterTx(fns ...func(DB) error)
Register registers new database migration. Must be called from file with name like "1_initialize_db.go", where: - 1 - migration version; - initialize_db - comment.
RegisteredMigrations returns currently registered Migrations.
RegisterTx is just like Register but marks the migration to be executed inside a transaction.
Run runs command on the db. Supported commands are: - up [target] - runs all available migrations by default or up to target one if argument is provided. - down - reverts last migration. - reset - reverts all migrations. - version - prints current db version. - set_version - sets db version without running migrations.
func SetVersion(db DB, version int64) error
Package-Level Variables (total 3, in which 1 are exported)
Package-Level Constants (total 2, neither is exported)