Skip to content

Adopt a live database

llms.txtlists every page for an agent

For a team whose database already exists: read it into declarations and a baseline migration, then change it only through migrations.

Works

  • yodel init --from <env> reads the live database into src/ and plans it back to no change before it writes anything
  • A baseline migration recorded as applied, with none of its statements run
  • Access adopted with the tables when the environment manages it: policies and grants, and on ClickHouse users and roles
  • yodel init --baseline for another environment that holds the same schema

Differs

By database

  • A project owns ClickHouse databases (yodel create <dir> --clickhouse --database <name>).
  • A rebuild keeps the old table until yodel cleanup drops it, and lint flags mutations and rebuilds (ch-mutation, ch-rebuild).

By forge

  • The writer's secrets are secrets of a GitHub environment limited to main.
  • The plan comment and the drift issue use the job's own token.

First step

Terminal window
YODEL_CREDENTIALS=writer npx yodel init --from <env> --force

Adopting an existing database

Proof

Each claim runs what this room relies on against a real server, once plain (it passes) and once with the behaviour broken (the claim catches it). Claims status lists every claim.

ClaimWhat it saysPlain, broken
adoptyodel init --from adopts a live database without touching it, and yodel plan then shows no change; on Postgres its policies, row-level security and grants too, on ClickHouse its dictionaries, functions, roles, users, row policies and grants; yodel init --baseline records the baseline, behind the gate, in a second environment that holds the same schema, and refuses one that differsClickHouse: pass, caughtPostgres: pass, caught

Then read

Tasks
Starting a projectSetting up each forge
Background
The two workflowsAccess control
Reference
The commandsInstalling and configuring

SQL Yodeler