defmodule VavPipeline.Repo.Migrations.BedikahPairs do use Ecto.Migration @moduledoc """ The paired reading (bishearecha.md §VI — one weight, one measure): two bedikot weighed with the same stone. The record keeps the counts on each side, the measures that leaned, and the verdict; the outputs themselves are in `bedikot` by hash. Append-only. """ def change do create table(:bedikah_pairs) do add :pair_ref, :string, null: false add :bedikah_ref_a, :string, null: false add :bedikah_ref_b, :string, null: false add :provenance_a, :string, null: false add :provenance_b, :string, null: false add :measures_a, :jsonb, default: "{}", null: false add :measures_b, :jsonb, default: "{}", null: false add :leans, :jsonb, default: "[]", null: false add :violations, {:array, :text}, default: [], null: false add :verdict, :string, null: false add :weighed_at, :utc_datetime, null: false timestamps(type: :utc_datetime, updated_at: false) end create unique_index(:bedikah_pairs, [:pair_ref]) create index(:bedikah_pairs, [:weighed_at]) end end