migrationinit

package
v0.1.59 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package migrationinit protects the current-schema initialization boundary. It supports a fresh database, the exact current schema, and one explicitly fingerprinted predecessors. Every other historical or drifted state fails before the migration driver can mutate it.

Index

Constants

View Source
const (
	CoreVersion int64 = 92
	// CoreShapeVersion is the migration version the shape constants below were
	// measured against. The digest and the object counts come from a live
	// catalog, so adding a migration cannot update them offline; leaving them
	// stale would pass every test and then fail the postflight shape check at
	// deploy time. A test requires these two to match, turning that into a
	// local failure with an explicit instruction.
	CoreShapeVersion int64 = 92
	// CoreUpgradeShapeVersion is the predecessor version CoreUpgradeSchemaDigest
	// and the upgrade counts were measured against. Raising CoreUpgradeVersion
	// without remeasuring would make the upgrade path validate a predecessor
	// against another version's fingerprint.
	CoreUpgradeShapeVersion        int64 = 91
	CoreUpgradeVersion             int64 = 91
	CoreReviewedBridgeVersion      int64 = 88
	CoreLegacyBridgeVersion        int64 = 86
	CloudVersion                   int64 = 55
	CoreSchemaDigest                     = "e084600f77368364f2ce4e5682606aafc2200a34f4d41583f75cc7ad06209fdc"
	CoreUpgradeSchemaDigest              = "1b2591b579018b4edd6465e19f36823fca28af01068742358293d1367c1c1ed8"
	CoreReviewedBridgeSchemaDigest       = "fb26f772c0a32842f968a7b6f3b6afcf0b0cdf89f20df556a7df6d67e0aa1e3e"
	CoreLegacyBridgeSchemaDigest         = "6c22808a8cd658cf827a5828a92d3343f040d7d6ff3302f9fdab691fe90aec5b"
	CloudSchemaDigest                    = "0cf21f9a518d9875e62e66e1b490148e45b67eaaeddf9cab118efd778575abd5"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MigrationTableState

type MigrationTableState struct {
	Exists  bool
	Rows    int64
	Version int64
	Dirty   bool
}

MigrationTableState is the complete state of one golang-migrate version table. Rows must be exactly one whenever the table exists.

type SchemaShape

type SchemaShape struct {
	Digest            string
	Tables            int64
	Constraints       int64
	Indexes           int64
	Triggers          int64
	GuardFunctions    int64
	CoreIdentities    int64
	RuntimeControls   int64
	RuntimeSchemas    int64
	CurrentRuntime    int64
	RuntimeWires      int64
	CurrentWire       int64
	PreviousWire      int64
	BuiltInSkills     int64
	BuiltInSkillCases int64
}

SchemaShape is a closed current-schema fingerprint for one owner. The object counts are scoped to the owner's canonical tables.

type Snapshot

type Snapshot struct {
	Core                      MigrationTableState
	Cloud                     MigrationTableState
	NonBookkeepingObjects     int64
	CoreShape                 SchemaShape
	CloudShape                SchemaShape
	ObsoleteCloudObjects      int64
	UnclassifiedBrowserAgents int64
	CallbackOwnerIndexValid   bool
}

Snapshot contains migration bookkeeping plus immutable catalog evidence.

func Inspect

func Inspect(ctx context.Context, databaseURL string) (Snapshot, error)

Inspect reads initialization evidence without creating migration tables.

func (Snapshot) ValidateCloudUp

func (s Snapshot) ValidateCloudUp() (bool, error)

ValidateCloudUp returns true when the current Cloud schema is already installed.

func (Snapshot) ValidateCoreUp

func (s Snapshot) ValidateCoreUp() (bool, error)

ValidateCoreUp returns true when the current schema is already installed.

Jump to

Keyboard shortcuts

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