## SQL Migration Notes

This project applies SQL migrations directly to the Neon-backed Postgres database via `DATABASE_URL`.
There is no Supabase migration path in the active workflow.

This package is primarily push-based via `pnpm --filter @workspace/db run push`.

The `.sql` files in this folder are mixed-purpose:

- Some are still valid forward migrations for the current schema.
- Some are historical one-time transition scripts from the removed `lending_pools` model.

### Current runner

Use:

```bash
pnpm -C lib/db run migrate:sql
```

Dry run:

```bash
pnpm -C lib/db run migrate:sql:dry-run
```

Single explicit file:

```bash
pnpm -C lib/db run migrate:sql:file -- lib/db/migrations/<file>.sql
```

### Retired migrations

These files are intentionally excluded from the current SQL migration runner because they depend on the removed `lending_pools` era schema:

- `20260707_lending_economics_config.sql`
- `20260707_lending_plan_tier_gating.sql`
- `20260711_lending_templates_opportunities.sql`

They remain in the repository as historical reference only.
