Anvil.Schema.SchemaVersion (Anvil v0.1.1)

View Source

Ecto schema for label schema versions.

Tracks evolution of label schemas with immutability guarantees. Once a schema version is frozen (first label written), it becomes read-only.

Summary

Functions

Freezes a schema version, making it immutable.

Checks if schema version can be modified.

Types

t()

@type t() :: %Anvil.Schema.SchemaVersion{
  __meta__: term(),
  frozen_at: DateTime.t() | nil,
  id: Ecto.UUID.t(),
  inserted_at: DateTime.t(),
  label_count: integer(),
  queue_id: Ecto.UUID.t(),
  schema_definition: map(),
  transform_from_previous: String.t() | nil,
  version_number: integer()
}

Functions

freeze(schema_version)

Freezes a schema version, making it immutable.

mutable?(arg1)

@spec mutable?(t()) :: boolean()

Checks if schema version can be modified.

A schema version is mutable if:

  • It has not been frozen (frozen_at is nil)
  • It has no labels (label_count is 0)