Expand description
Naming conventions and helpers for vespertide database schema management.
This crate provides consistent naming functions for database objects like indexes, constraints, and foreign keys. It has no dependencies and can be used by any other vespertide crate.
Functions§
- build_
check_ constraint_ name - Generate CHECK constraint name for SQLite enum column. Uses double underscore to separate table name from the rest. Format: chk_{table}__{column}
- build_
enum_ type_ name - Generate enum type name with table prefix to avoid conflicts. Always includes table name to ensure uniqueness across tables. Format: {table}_{enum_name}
- build_
foreign_ key_ name - Generate foreign key constraint name from table name, columns, and optional user-provided key. Always includes table name to avoid conflicts across tables. Uses double underscore to separate table name from the rest. Format: fk_{table}{key} or fk_{table}{col1}_{col2}…
- build_
index_ name - Generate index name from table name, columns, and optional user-provided key. Always includes table name to avoid conflicts across tables. Uses double underscore to separate table name from the rest. Format: ix_{table}{key} or ix_{table}{col1}_{col2}…
- build_
relation_ enum_ name - Generate relation enum name for FK relations.
- build_
reverse_ relation_ field_ name - Generate reverse relation field name for has_many/has_one relations.
- build_
unique_ constraint_ name - Generate unique constraint name from table name, columns, and optional user-provided key. Always includes table name to avoid conflicts across tables. Uses double underscore to separate table name from the rest. Format: uq_{table}{key} or uq_{table}{col1}_{col2}…
- extract_
relation_ prefix - Extract semantic prefix from FK column for reverse relation naming.
- pluralize
- Simple pluralization for relation field names.
- to_
pascal_ case - Convert snake_case to PascalCase.