Foresight.Migrations.Manifest (Foresight v0.1.1)

Copy Markdown View Source

Classifies every migration shipped with Foresight.

The manifest is intentionally exhaustive. Consumer installation uses only the :control entries, while tenant provisioning uses only the :tenant entries. Historical :public_data repairs remain available to standalone deployments that migrate Foresight's own public schema, but are not replayed into newly provisioned consumer tenant schemas. Adding a packaged migration without classifying it makes both public operations fail closed.

Summary

Types

A packaged migration's installation target.

Functions

Returns the complete filename-to-classification manifest.

Returns sorted packaged migration filenames for one classification.

Verifies that path contains exactly the migrations in the manifest.

Types

classification()

@type classification() :: :control | :tenant | :public_data

A packaged migration's installation target.

Functions

entries()

@spec entries() :: %{required(String.t()) => classification()}

Returns the complete filename-to-classification manifest.

files(classification)

@spec files(classification()) :: [String.t()]

Returns sorted packaged migration filenames for one classification.

validate(path)

@spec validate(String.t()) :: :ok | {:error, term()}

Verifies that path contains exactly the migrations in the manifest.

Unknown, missing, duplicate-version, and malformed migration files are rejected. This prevents a newly packaged migration from silently landing in the wrong schema.