migrate

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package migrate exposes the `arctl db migrate` subcommand. The root CLI normally passes migration sources directly to NewCommand; the package registry remains for lower-level callers that construct the migrate command without explicit sources.

Each source owns its own Postgres schema (set via `golang-migrate`'s `migratepgx.Config{SchemaName: ...}`), so adding a source never moves the OSS source's integer counter — the addressing footgun from the prior shared-table design is gone.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand(sources ...Source) *cobra.Command

NewCommand returns the `migrate` parent command with all subcommands attached. The `--source` flag is wired only when more than one source is configured.

func Register

func Register(s Source)

Register adds a migration source to the package registry.

Validates Name against ^[a-z][a-z0-9_]*$. Panics on invalid charset and duplicate Name so source misconfiguration fails fast.

The mutex is defense-in-depth so a contract-violating caller running Register concurrently doesn't trigger a silent data race against Sources().

func ResetForTesting

func ResetForTesting()

ResetForTesting clears the source registry. Test-only.

Types

type Source

type Source = orchestrator.Source

Source aliases orchestrator.Source so a single struct value satisfies both the CLI registry (per-source operations) and the orchestrator's RunUp input (cross-source up). Fields are documented on orchestrator.Source; the alias keeps consumers from needing to import both packages.

func Sources

func Sources() []Source

Sources returns a copy of the registered sources in registration order. Returning a copy prevents callers from holding a reference that could race with a subsequent Register call.

Jump to

Keyboard shortcuts

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