# opencode database guide ## Database - **Schema**: Drizzle schema lives in `src/**/*.sql.ts`. - **Naming**: tables and columns use snake*case; join columns are `_id`; indexes are `*\_idx`. - **Migrations**: generated by Drizzle Kit using `drizzle.config.ts` (schema: `./src/**/*.sql.ts`, output: `./migration`). - **Command**: `bun run db generate --name `. - **Output**: creates `migration/_/migration.sql` and `snapshot.json`. - **Tests**: migration tests should read the per-folder layout (no `_journal.json`).