Code generation
Rust, TypeScript, Python and C# code from the model, deterministic and with every loss reported.
databee generate code --lang rust
databee generate code --lang typescript --output src/db
--lang |
Output |
|---|---|
rust |
sqlx FromRow structs and enums |
typescript |
a Drizzle schema |
python |
SQLAlchemy 2.0 models in one models.py |
csharp |
EF Core entities and a DbContext |
Files go to generated/<lang>/ in the project, or to --output. The generator is a pure function of the model: the same model gives the same files, and it never connects to a database. Each file’s header comment states which library versions it needs.
What it reports
A library cannot carry everything a database can. What is left out is reported as DB-GEN-* findings on the model object, with project file and JSON path, for example check constraints, partial or expression indexes, DEFERRABLE keys, native types without a mapping, and renamed identifiers. Fix the model, not the output: generated files are overwritten on the next run.
Over MCP the same generator is generate_code in the generator profile. It returns the files inline, or with output: true writes them below generated/ only.
DDL and DBML
databee generate ddl # the project's dialect
databee generate ddl --dialect mysql # postgres, mysql, sqlite, mssql, mongodb
databee generate dbml
DDL for another dialect is written from the logical types. What only the other dialect describes is reported as DB-DDL-*. For a MongoDB project, --dialect mongodb writes a mongosh script with createCollection and a $jsonSchema validator, and createIndex per index.