Skip to main content
The TypeScript schema describes the current database. The migration journal explains how an existing deployment reaches it. Commit both in the same change.

Generate the next version

Add the column in src/schema.ts, then run the generator.
For example:
src/schema.ts
The generator inspects the schema twice in separate Bun processes and rejects different output. It writes src/migrations/v2.json, src/migrations/v2.ts, and an updated src/migrations.ts, then verifies the complete digest chain. The TypeScript file contains both the immutable schema snapshot and the reviewed additive statements. Never edit a migration after it has run in any shared environment. Generate a new version instead.

Prove the upgrade

Run the migration test against both an empty database and the previous schema version.
The generated Vitest path covers a fresh Miniflare database. Before changing a shared experiment, also test the exact previous schema, existing rows, the new write path, and a restart after activation.

Apply it

bun run deploy uploads the Worker and runs the packaged journal in maintenance mode. Application traffic stays closed while CharDB upgrades each organization shard and the Better Auth catalog. If the command stops halfway through, rerun it with the same migration ID and target. CharDB resumes from durable progress rather than replaying completed steps. Schema history moves forward. There is no down migration, rollback endpoint, or abort path for statements that already ran. To undo an application change, ship another forward migration and compatible code.
This release accepts new tables, nonunique indexes, and nullable unconstrained columns. It rejects drops, renames, type or constraint changes, new unique indexes, and changes to existing file or vector resources.