@@ -34,6 +34,28 @@ The schema URL provides:
3434
3535---
3636
37+ ## Post-Edit Validation (MANDATORY)
38+
39+ ** After EVERY edit to a model file, ALWAYS run these checks:**
40+
41+ ``` bash
42+ # 1. Check for parsing errors and schema violations
43+ vespertide diff
44+
45+ # 2. Preview generated SQL to verify correctness
46+ vespertide sql
47+ ```
48+
49+ ** Verify the output:**
50+ - ` vespertide diff ` shows expected changes (no unexpected additions/removals)
51+ - ` vespertide sql ` generates valid SQL for your target database
52+ - IDE shows no red squiggles (schema validation errors)
53+ - All required fields (` name ` , ` type ` , ` nullable ` ) are present
54+
55+ ** Only proceed to ` vespertide revision ` after verification passes.**
56+
57+ ---
58+
3759## Installation
3860
3961``` bash
@@ -201,8 +223,7 @@ vespertide revision -m "add status column"
201223| ` "interval" ` | INTERVAL | Time duration |
202224| ` "bytea" ` | BYTEA | Binary data |
203225| ` "uuid" ` | UUID | UUIDs |
204- | ` "json" ` | JSON | JSON data |
205- | ` "jsonb" ` | JSONB | Binary JSON (indexable, recommended) |
226+ | ` "json" ` | JSON | JSON data (cross-database compatible) |
206227| ` "inet" ` | INET | IPv4/IPv6 address |
207228| ` "cidr" ` | CIDR | Network address |
208229| ` "macaddr" ` | MACADDR | MAC address |
@@ -261,7 +282,9 @@ vespertide revision -m "add status column"
261282> - Better for frequently-changing value sets
262283> - Works identically across PostgreSQL, MySQL, SQLite
263284
264- #### Custom Type (fallback)
285+ #### Custom Type (AVOID - last resort only)
286+
287+ > ** WARNING** : Avoid custom types. They break cross-database compatibility. Use built-in types or redesign your schema.
265288
266289``` json
267290{ "kind" : " custom" , "custom_type" : " POINT" }
@@ -508,7 +531,7 @@ Both columns with `"primary_key": true` creates a **single composite primary key
508531 "nullable" : false ,
509532 "default" : " 'pending'"
510533 },
511- { "name" : " metadata" , "type" : " jsonb " , "nullable" : true },
534+ { "name" : " metadata" , "type" : " json " , "nullable" : true },
512535 { "name" : " created_at" , "type" : " timestamptz" , "nullable" : false , "default" : " NOW()" },
513536 { "name" : " updated_at" , "type" : " timestamptz" , "nullable" : true }
514537 ]
@@ -638,7 +661,7 @@ Both columns with `"primary_key": true` creates a **single composite primary key
6386611 . ** Use enums for status/category fields** - Prefer over text + CHECK
6396622 . ** Use integer enums for expandable sets** - No migration needed for new values
6406633 . ** Use ` timestamptz ` over ` timestamp ` ** - Timezone-aware is safer
641- 4 . ** Use ` jsonb ` over ` json ` ** - Indexable and faster
664+ 4 . ** Use ` json ` type for JSON data ** - Works across all backends (PostgreSQL, MySQL, SQLite)
642665
643666### MUST NOT DO
644667
@@ -648,6 +671,9 @@ Both columns with `"primary_key": true` creates a **single composite primary key
6486714 . ** Never use table-level constraints** - Except for CHECK expressions only
6496725 . ** Never manually create/edit migration files** - Only ` fill_with ` exception
6506736 . ** Never manually edit exported ORM files** - Use ` vespertide export ` to regenerate
674+ 7 . ** Never use ` jsonb ` type** - Use ` json ` instead (JSONB not supported in SQLite)
675+ 8 . ** Never use custom types** - Use built-in types only for cross-database compatibility
676+ 9 . ** Never use array types** - Use a separate join table instead (arrays not supported in SQLite)
651677
652678### Naming Conventions
653679
@@ -675,7 +701,7 @@ boolean Flags
675701date, time, timestamp, timestamptz Time
676702interval Duration
677703uuid UUIDs
678- json, jsonb JSON
704+ json JSON
679705bytea Binary
680706inet, cidr, macaddr Network
681707xml XML
0 commit comments