migrator

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoChange         = errors.New("no change")
	ErrNoAssetsProvided = errors.New("no migration assets provided")
	ErrNoMigration      = errors.New("no migration found")
)

Functions

This section is empty.

Types

type MigrationAssets

type MigrationAssets struct {
	AssetNames []string
	AssetFn    func(name string) ([]byte, error)
	TableName  string
}

func GetCoreMigrationAssets

func GetCoreMigrationAssets() *MigrationAssets

func GetInjectorMigrationAssets

func GetInjectorMigrationAssets() *MigrationAssets

type MigrationStatus

type MigrationStatus struct {
	TableName              string
	Version                uint
	Dirty                  bool
	ExpectedMigrationCount uint
}

type Migrator

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

func NewPGMigrator

func NewPGMigrator(pgURL string, migrationAssets []*MigrationAssets) (*Migrator, error)

NewPGMigrator creates a new Migrator instance for the provided Postgres URL and migration assets. The provided assets will be used to create separate migrators, each managing its own schema_migrations table under the pgstream schema. They will be applied in the order they are provided.

func (*Migrator) Close

func (m *Migrator) Close()

func (*Migrator) Down

func (m *Migrator) Down() error

Down will revert the migrations provided in the migration assets. They will be reverted in reverse order.

func (*Migrator) Status

func (m *Migrator) Status() ([]MigrationStatus, error)

func (*Migrator) Up

func (m *Migrator) Up() error

Up will apply all the migrations provided in the migration assets.

Jump to

Keyboard shortcuts

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