golazy.dev golazy.dev / pg / pgmigrate Index | Files

package pgmigrate

import "golazy.dev/pg/pgmigrate"

Package pgmigrate implements PostgreSQL migrations for golazy.dev/lazymigrate.

Migration files are self-contained SQL files with lazy markers:

-- +lazy Up
CREATE TABLE example (...);

-- +lazy Down
DROP TABLE example;

Variables

var ErrSchemaUnsupported

ErrSchemaUnsupported is returned by schema load/dump methods until this backend grows pg_dump/pg_restore semantics.

var ErrSchemaUnsupported = errors.New("pgmigrate: schema load and dump are not implemented")

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}
func New
func New(pool *pgxpool.Pool) *Backend
func (backend *Backend) DumpSchema
func (backend *Backend) DumpSchema(context.Context) ([]byte, error)
func (backend *Backend) List
func (backend *Backend) List(ctx context.Context) ([]lazymigrate.BackendMigration, error)
func (backend *Backend) LoadSchema
func (backend *Backend) LoadSchema(context.Context, []byte) error
func (backend *Backend) Run
func (backend *Backend) Run(ctx context.Context, step lazymigrate.Step) error
func (backend *Backend) Setup
func (backend *Backend) Setup(ctx context.Context) error