Generates the Ecto migrations backing
AttestoMCP.Server.SessionStore.Ecto and
AttestoMCP.Server.UrlElicitationStore.Ecto.
The generated migrations create two PostgreSQL tables:
attesto_mcp_sessions and attesto_mcp_url_elicitations. Rows are keyed by
the namespace and an identifier so several independently named MCP servers
can safely share a repository.
The attesto_mcp_sessions table stores complete versioned session records as
JSONB in record; created_at_ms, last_seen_ms, absolute_timeout_ms, and
idle_timeout_ms mirror the record for validation, while expires_at_ms is a
denormalized value used for bounded SQL-side expiry filtering and cleanup.
A separate concurrent expression index supports per-principal admission. An
existing host can rerun this task to generate that index migration without
replacing its table migrations.
The attesto_mcp_url_elicitations table stores staged approval records with
their action, JSONB fields, timestamps, and optional consumed timestamp for
atomic single-use verification.
This task only writes migration files. It never invokes Ecto.Migrator or
changes the database. Apply the files from the host application's normal
migration workflow.
Usage
mix attesto_mcp_server.gen.migration --repo MyApp.RepoOptions
--help- print usage and the accepted options, then exit without generating a migration.--repo- the Ecto repo the migrations are generated for. It may be supplied more than once when several repos intentionally share the same application package. When omitted, configured Ecto repos are discovered usingMix.Ecto, and none or an ambiguous set is rejected.--schema-prefix- an optional validated PostgreSQL schema used as Ecto'sprefix:for every table and index. The schema is created withCREATE SCHEMA IF NOT EXISTSby the migration and is left in place on rollback. Table names are fixed because the runtime schemas queryattesto_mcp_sessionsandattesto_mcp_url_elicitations.--migrations-path- directory in which migrations are written. It defaults to the repo'spriv/<repo>/migrationsdirectory. An explicit path may only be used with one repo so generation cannot partially write competing migrations into the same directory.--skip-url-elicitations- do not generate the optionalattesto_mcp_url_elicitationstable. A host that does not use URL elicitation can rerun the task for later additions, such as the principal admission index, without that table coming back.
Each migration file is skipped when a file with that base name already exists
in the path. An existing host that reruns the task therefore receives only the
new file. Generated files are formatted and end with a newline, so they pass
mix format --check-formatted unchanged.
The generated migrations are idempotent: tables and indexes are created only when absent and dropped only when present. The principal admission index migration depends on the sessions table and fails before any DDL when that table does not exist, so Ecto does not record it as applied and it runs again once the sessions migration has been applied.