Files
amcs/schema/README.md
Hein db7b152852
Some checks failed
CI / build-and-test (push) Failing after -31m25s
refactor(store): replace project and skill models with generated models
* Update project creation and retrieval to use generated models
* Modify skill addition and listing to utilize generated models
* Refactor thought handling to incorporate generated models
* Adjust tool annotations to align with new model structure
* Update API calls in the UI to use new ResolveSpec-based endpoints
* Enhance stats retrieval logic to aggregate thought metadata
2026-04-26 12:56:32 +02:00

50 lines
1.1 KiB
Markdown

# Schema workflow
The `schema/*.dbml` files are the database schema source of truth.
## Generate SQL migrations
Run:
```bash
make generate-migrations
```
This uses `relspec` to convert the DBML files into PostgreSQL SQL and writes the generated schema migration to:
- `migrations/020_generated_schema.sql`
## Generate ResolveSpec models
Run:
```bash
make generate-models
```
This uses `relspec` to convert `schema/*.dbml` into Bun/ResolveSpec-compatible
Go models in:
- `internal/generatedmodels/`
## Check schema drift
Run:
```bash
make check-schema-drift
```
This regenerates the SQL from `schema/*.dbml` and compares it with `migrations/020_generated_schema.sql`.
If the generated output differs, the command fails so CI can catch schema drift.
## Workflow
1. Update the DBML files in `schema/`
2. Run `make generate-migrations`
3. Run `make generate-models`
4. Review generated SQL and generated models
5. Commit DBML changes and generated outputs
Existing handwritten migrations stay in place. Going forward, update the DBML first and regenerate the SQL from there.