upgrade

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package upgrade implements the "admin upgrade" command, which migrates the nitpicking database from v1 to v2 schema. The migration converts claimed-state issues to open, removes obsolete history event types, and records the new schema version — all in a single atomic transaction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmd

func NewCmd(f *cmdutil.Factory, runFn ...func(context.Context, RunInput) error) *cli.Command

NewCmd constructs the "admin upgrade" command, which checks the database schema version and applies the v1→v2 migration when needed. An optional runFn parameter replaces the default Run for testing; when injected, the service is not constructed and the runFn receives only the IOStreams fields of RunInput (Svc is nil).

func Run

func Run(ctx context.Context, input RunInput) error

Run executes the upgrade workflow: checks the schema version and, when the database is v1, applies the v1→v2 migration atomically. On a v2 database it reports "up to date" without making any changes.

Types

type RunInput

type RunInput struct {
	// Svc is the application service through which schema migration operations
	// are invoked. The upgrade command never imports a concrete storage adapter;
	// all migration capability is accessed via this driving port interface.
	Svc driving.Service

	// JSONOutput requests machine-readable JSON output when true.
	JSONOutput bool

	// Out receives the human-readable or JSON output.
	Out io.Writer

	// ColorScheme provides terminal colour helpers for human-readable output.
	ColorScheme *iostreams.ColorScheme
}

RunInput holds all parameters for the upgrade command's core logic, decoupled from CLI flag parsing so it can be tested directly.

Jump to

Keyboard shortcuts

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