You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// CORRECT - Always use wrapped variantColumnType::Simple(SimpleColumnType::Integer)SimpleColumnType::Integer.into()// WRONG - Old flat syntaxColumnType::Integer// Does not exist
ColumnDef Initialization
ALL fields required including inline constraint fields:
ColumnDef{
name, r#type, nullable, default, comment,primary_key:None,// Must includeunique:None,// Must include index:None,// Must includeforeign_key:None,// Must include}
Naming
Indexes: ix_{table}__{columns} or ix_{table}__{name}
Unique: uq_{table}__{columns}
Foreign keys: fk_{table}__{columns}
ANTI-PATTERNS
Pattern
Why Bad
ColumnType::Integer
Use ColumnType::Simple(SimpleColumnType::Integer)
Forgetting inline fields in ColumnDef
Will cause compile errors - 4 Option fields required
Raw SQL in migrations
Use typed MigrationAction enums
Skipping normalize() on TableDef
Inline constraints won't convert to table-level
Assuming YAML works
YAML loading NOT implemented (templates only)
COMMANDS
# Build/Test
cargo build
cargo test
cargo clippy --all-targets --all-features
cargo fmt
# CLI (always use -p vespertide-cli)
cargo run -p vespertide-cli -- init
cargo run -p vespertide-cli -- new <model>
cargo run -p vespertide-cli -- diff
cargo run -p vespertide-cli -- sql
cargo run -p vespertide-cli -- revision -m "message"
cargo run -p vespertide-cli -- export --orm seaorm
# Regenerate JSON schemas
cargo run -p vespertide-schema-gen -- --out schemas
# Snapshot testing
cargo insta test -p vespertide-exporter
cargo insta accept