legacymigrate

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: 9 Imported by: 0

Documentation

Overview

Package legacymigrate copies legacy OSS data from the prior `v1alpha1.*` schema into the orchestrator-owned `agentregistry` schema. The orchestrator calls `RunOSS` once per upgraded deployment (gated on `public.schema_migrations` existing and the new schema's `schema_migrations` being empty); fresh installs and re-runs skip it.

A follow-up release will ship a regular migration that drops the residue `v1alpha1.*` tables, at which point this package can be removed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OSSSource

func OSSSource() orchestrator.Source

OSSSource returns the orchestrator.Source value for the OSS migration set. Used by both the server startup path (`internal/registry/database/postgres.go`) and the CLI's `arctl db migrate up` to register or run the OSS source with identical configuration.

func RunOSS

func RunOSS(ctx context.Context, db *sql.DB, schema database.Schema) error

RunOSS copies each `v1alpha1.<t>` row into the destination `schema`'s `<t>` (the OSS schema in practice) via `INSERT (cols) ... SELECT cols ... ON CONFLICT DO NOTHING` inside a single transaction. schema is the orchestrator-resolved Source.Schema, passed in rather than re-derived. Columns are addressed explicitly so the copy stays correct if source and destination column orders ever diverge. Defensive: if `v1alpha1.agents` doesn't exist, returns nil without touching the database (the orchestrator already gates on `public.schema_migrations` existing, so this is belt-and-suspenders). Within the copy loop, each table is probed individually with `to_regclass` and skipped if missing so an operator who manually dropped one of the legacy tables doesn't fault the entire bridge.

Partial failure rolls back the whole copy; the orchestrator's advisory lock + re-run guard cover the retry.

Legacy `v1alpha1.*` tables are not dropped — a follow-up regular go-migrate migration handles that.

Types

This section is empty.

Jump to

Keyboard shortcuts

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