Skip to main content

Crate vespertide_naming

Crate vespertide_naming 

Source
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.