zyvor dev
Generates once, then watches your schema and regenerates on every save.
zyvor dev
Output
π Watching .zyvor/schema.zyvor for changes...
Press Ctrl+C to stop
β
Generated 13 modular files in ".zyvor/generated"
β
Generated: .zyvor/generated/ (modular)
β
Generated: .zyvor/migrations/0001_initial.sql
πΎ Snapshot saved
On a schema change:
π Schema change detected! Regenerating...
π Schema change detected! Generated: 0002_schema_update.sql
πΎ Snapshot saved
β
Regeneration complete
What it does each cycle
- read β lex β parse β validate
- compare source against
migrations/snapshot.json - if unchanged:
π Schema unchanged. Skipping.β nothing written - if changed: write modular entities, regenerate initial SQL, diff against the old snapshot, write an auto-numbered diff migration, save the new snapshot
A 300 ms debounce absorbs the double-write some editors do on save.
How to use it
Leave it running in one terminal. Work in another:
# terminal 1
zyvor dev
# terminal 2
zyvor migrate --apply
cargo run
dev never touches your database. It only writes files. Applying is a
separate, deliberate step.
Errors donβt kill the watcher
If you save a broken schema mid-edit, you get:
β Regeneration failed: <error>
The watcher keeps running. Fix the schema, save again, and it recovers. Your previously generated files stay on disk untouched.
Requires init first
No .zyvor/schema.zyvor found. Run 'zyvor init' first.