mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 22:03:58 +00:00
Co-authored-by: Github Action <action@github.com> Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: Brendan Allan <git@brendonovich.dev>
11 lines
563 B
Markdown
11 lines
563 B
Markdown
# opencode database guide
|
|
|
|
## Database
|
|
|
|
- **Schema**: Drizzle schema lives in `src/**/*.sql.ts`.
|
|
- **Naming**: tables and columns use snake*case; join columns are `<entity>_id`; indexes are `<table>*<column>\_idx`.
|
|
- **Migrations**: generated by Drizzle Kit using `drizzle.config.ts` (schema: `./src/**/*.sql.ts`, output: `./migration`).
|
|
- **Command**: `bun run db generate --name <slug>`.
|
|
- **Output**: creates `migration/<timestamp>_<slug>/migration.sql` and `snapshot.json`.
|
|
- **Tests**: migration tests should read the per-folder layout (no `_journal.json`).
|