migrate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package migrate is the shared migration runner used by both Postgres and ClickHouse. It wraps golang-migrate with per-migration timing, filename-aware error wrapping, and an operator-friendly runbook when the schema is left dirty by a prior failed apply.

Boot wiring:

┌─────────────┐   driver  ┌──────────────┐
│ postgres or │──────────▶│  migrate.Run │──▶ Up()/ErrNoChange
│ clickhouse  │           │              │──▶ ErrDirty → runbook
│   pkg       │   fs.FS   │              │──▶ Logger →   slog
└─────────────┘──────────▶│              │
                          └──────────────┘

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, label string, driver database.Driver, fsys fs.FS, root string, logger *slog.Logger) error

Run applies all pending migrations from fsys (rooted at root) using the supplied database driver. label identifies the dialect ("pg" or "ch") in logs and error messages.

Behavior:

  • migrate.ErrNoChange → success, logged at info
  • migrate.ErrDirty → returned with an operator runbook embedded in the message
  • any other error → wrapped with label and current schema version

Types

This section is empty.

Jump to

Keyboard shortcuts

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