pgmigrate

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tables added in v0.5.0

func Tables(ctx context.Context, pool *pgxpool.Pool) ([]string, error)

Tables lists every base table visible in the current schema, framework and product tables alike, sorted (P1-1, orkome pack rollout): migrations know the DDL surface, so test-isolation code (TRUNCATE lists, allowlist guards) should derive its table list from here instead of hand-maintaining a second inventory that silently rots every time a migration adds a table. The pgmigrate bookkeeping table (schema_migrations) is excluded.

func Up

func Up(ctx context.Context, pool *pgxpool.Pool, fsys fs.FS, subdir string) error

Types

type Hook

type Hook func(ctx context.Context, conn *pgxpool.Conn) error

type Migrator

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

func New

func New(pool *pgxpool.Pool, fsys fs.FS, subdir string) *Migrator

func (*Migrator) Down

func (m *Migrator) Down(ctx context.Context, limit int) ([]string, error)

func (*Migrator) RegisterPreHook

func (m *Migrator) RegisterPreHook(version string, h Hook)

func (*Migrator) Status

func (m *Migrator) Status(ctx context.Context) ([]StatusRow, error)

func (*Migrator) Up

func (m *Migrator) Up(ctx context.Context, limit int) ([]string, error)

type StatusRow

type StatusRow struct {
	Version   string
	Applied   bool
	AppliedAt *string

	Orphan bool
}

Jump to

Keyboard shortcuts

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