Content · 5 / 23
Schema builder
Add types and fields in the admin, review the change, and apply it as the TypeScript file and migration you would have written.
- 1Kind
- 2Basics
- 3Rules and display
Follows the label until you type one.
- 1Changes
- 2Files and SQL
- 3Apply
0008_add_article_read_time.sql
ALTER TABLE "content_article"
ADD COLUMN "read_time" integer; One migration in one transaction, then article.ts rewritten. Commit both with the code that reads the field.
How it works
- 01
Add a type or a field in the Content Model page, in development.
- 02
Review each change’s verdict, the files and the SQL drizzle-kit wrote.
- 03
Apply: the migration runs, the files are written, the server restarts.
- Writes
- TypeScript and a drizzle-kit migration
- Runs
- In development only
- Owns
- No tables, no runtime schema
In depth · For whoever sets up the model
A form that writes your code
Add a type or a field in the admin, review the change, and apply — your repository gets a type module and a drizzle-kit migration to commit.
It writes files, nothing else
The builder has no table and no runtime registry. It writes the same formatted TypeScript a person would, and drizzle-kit generates the SQL. Delete the builder and every type it made keeps working.
Under the hood
It edits only files whose first line is // @orthacms-generated. Hand-written types are shown read-only and never rewritten.
The type file the builder wrote, with its ownership marker, beside the table after its migration added the read_time column.
Every change gets a verdict
| Verdict | What it covers |
|---|---|
| Safe | New types, optional fields, labels and order. |
| Check data | Tightened rules; existing values may no longer pass. |
| Deletes data | Removed fields or types, each confirmed on its own. |
| Not applied | Renames and type changes — make those in code. |
Safe to apply
- Checked as you type
- The form uses the server’s own rules and wording.
- All or nothing
- The migration runs in one transaction; files are written only after it commits.
- Never a prompt
- Removals and additions run as separate migrations, so drizzle-kit never has to ask.
- One apply at a time
- A stale draft is told so instead of overwriting someone else’s change.
- New types start ungranted
- After an apply, the admin offers which workspaces get the new type.
Development only
Editing needs SCHEMA_BUILDER=true, a non-production NODE_ENV and the source tree. In production the page is a read-only map, and schema changes ship like any other code.
Questions
Is a generated type different from one I write?
No. It is the same collection() call. Remove the marker line and the file is yours to edit by hand.
Who can use it?
Anyone who can read content sees the model. Editing it needs schema:manage, which only administrators hold.