Documentation
¶
Overview ¶
Package migrate owns supported live schema upgrades. Historical schema decoding belongs to internal/audit and retired layouts are recognized only for refusal, never parsed or relocated here.
Index ¶
- Constants
- func Build(ctx context.Context, root string) (applied []string, resultChanges []Change, mutations []FileMutation, ...)
- func CheckLive(root string) (int, error)
- func CheckLiveGeneration(gen int) error
- func Current() int
- func GateState(root string) (string, int, error)
- func GateStateForGeneration(gen int) string
- func Generation(root string) (int, error)
- func IsRetiredLayout(err error) bool
- func LiveSchemaRange() (int, int)
- func ProjectPresent(root string) (bool, error)
- func ProjectPresentFromFiles(has func(string) bool) bool
- type Change
- type Changes
- type FileMutation
- type Migration
- type ProposedTree
- type RetiredLayoutError
- type UpgradeRequiredError
Constants ¶
const LiveSchemaFloor = 46
LiveSchemaFloor is the oldest source generation this binary can operate on.
Variables ¶
This section is empty.
Functions ¶
func Build ¶ added in v0.40.0
func Build(ctx context.Context, root string) (applied []string, resultChanges []Change, mutations []FileMutation, returnErr error)
Build produces only registered supported migrations. It never decodes a below-floor source or writes the filesystem; the command composition maps its file mutations to the upgrade journal.
func CheckLiveGeneration ¶ added in v0.40.0
func GateStateForGeneration ¶ added in v0.22.0
func Generation ¶
Generation reads only a current-layout lock schema. Retired layouts receive a typed refusal before their authority representation can be decoded.
func IsRetiredLayout ¶ added in v0.40.0
IsRetiredLayout makes presentation boundaries distinguish layout refusal from a below-floor current lock without retaining a layout reader.
func LiveSchemaRange ¶ added in v0.40.0
func ProjectPresent ¶ added in v0.11.0
ProjectPresent recognizes current control files and retired layouts without interpreting their content.
func ProjectPresentFromFiles ¶ added in v0.22.0
Types ¶
type Change ¶ added in v0.30.0
type Change struct {
Text string
}
Change is one ordered semantic fact produced by a migration. It is data for the upgrade owner, not terminal output.
func CurrentSchemaChange ¶ added in v0.30.0
func CurrentSchemaChange() Change
CurrentSchemaChange reports the migration domain's proven no-migration state to its terminal owner.
type Changes ¶ added in v0.30.0
type Changes struct{}
Changes is the fact collector passed through the supported migration seam. The schema-46 floor entry is a no-op; the next supported migration will add the first concrete collection operation with its semantic fact.
type FileMutation ¶ added in v0.40.0
FileMutation is a planned replacement. migrate owns the semantic plan, while its caller owns the transaction that applies it.
type Migration ¶
type Migration struct {
To int
Name string
Build func(context.Context, *ProposedTree, *Changes) ([]FileMutation, error)
}
Migration is one ordered upgrade step for a supported live generation.
type ProposedTree ¶ added in v0.40.0
type ProposedTree struct {
// contains filtered or unexported fields
}
ProposedTree is the read-only tree view supplied to one migration step. It overlays every earlier step's plan on the confined project root, so ordered steps observe the state they are collectively proposing without mutating it.
type RetiredLayoutError ¶ added in v0.40.0
type RetiredLayoutError struct{ Layout string }
RetiredLayoutError identifies a removed layout without decoding its config.
func (*RetiredLayoutError) Error ¶ added in v0.40.0
func (e *RetiredLayoutError) Error() string
func (*RetiredLayoutError) Is ¶ added in v0.40.0
func (e *RetiredLayoutError) Is(target error) bool
type UpgradeRequiredError ¶ added in v0.40.0
type UpgradeRequiredError struct{ Generation, Current int }
func (*UpgradeRequiredError) Error ¶ added in v0.40.0
func (e *UpgradeRequiredError) Error() string