> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Supabase migration & types playbook

> One entry point for how Encore OS authors DDL, generates migrations, and regenerates types.

## Source of truth

`supabase/schemas/**` is the **canonical declarative desired-state** for DDL. `supabase/migrations/**` — the 2026-05-28 baseline (`00000000000000_baseline_2026_05_28_ddl.sql` + `…_data.sql`) plus `db diff`-generated forward files — is what actually gets applied. *(Backfill note: the existing schema is not yet bulk-exported into `supabase/schemas/**`; until that lands, the baseline + forward migrations are the operative SoT and `schemas/**` fills in as new DDL is authored declaratively.)* Live projects: **dev2** (`anuwknikgsijbameytzr`) / **prod2** (`aximlomrwfuhctxjhrsf`).

## Author DDL

1. Edit `supabase/schemas/**`.
2. `npm run db:schemas:diff -- -f <name>` to generate a migration.
3. `supabase db reset` to apply locally; `supabase db push` to promote.

See the [CLI workflow](/development/supabase/SUPABASE_CLI_LOCAL_WORKFLOW), [migration lanes](/development/supabase/MIGRATION_LANES), and the [declarative guide](/development/supabase/DECLARATIVE_SCHEMA_GUIDE).

## Regenerate types

`npm run db:types` (local) or `npm run db:types:dev2` (from dev2). CI runs `npm run db:types:check` to catch DB↔types drift.

## Never

Do not create or apply migrations via Supabase MCP (`apply_migration`) or the Dashboard — schema changes are **CLI-only**.
