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.
Click to show internal directories.
Click to hide internal directories.