Skip to main content

table_alias

Function table_alias 

Source
pub fn table_alias(table_name: &str) -> String
Expand description

Look up the database alias for a SQL table name — the reverse of the Model::NAME → alias lookup that model_alias does. Walks the registered model metas to find the one whose table matches (snake_case of the struct name + any #[umbral(table = "...")] override) and returns its alias if set. Falls back to "default" when no model owns the table (e.g. orphan schema, the umbral_migrations table itself) — those land on the main pool.

Used by the migration engine’s per-DB dispatch in run_in to route each operation to the right pool.