Ithibati.Catalogue (Ithibati v0.6.2)

Copy Markdown View Source

Reads PostgreSQL, SQLite and MySQL table, column and uniqueness metadata.

Ithibati.Migration and Ithibati.Doctor use these queries to apply the same checks during migration and setup diagnosis. Functions receive the repo explicitly; table lookup also takes a PostgreSQL schema prefix. SQLite uses the unprefixed main database; MySQL uses the repo's selected database without schema prefixes.

Summary

Functions

Returns {database_type, unique?} for a column, or nil if it does not exist.

Returns {:ok, description} when the column meets the configured account-key requirements.

Returns the table name, qualified with prefix when one is supplied, for diagnostic text.

Returns an opaque table reference, or nil when the table is absent.

Database column types compatible with a supported Ecto storage type.

Functions

column(repo, reference, column)

Returns {database_type, unique?} for a column, or nil if it does not exist.

Domains resolve to their underlying type. unique? requires a non-partial unique index whose only key column is this column. Additional included columns are allowed; for example, PRIMARY KEY (id) INCLUDE (email) qualifies.

key_column(repo, reference, table, column)

Returns {:ok, description} when the column meets the configured account-key requirements.

Returns {:error, description} for a missing column, an incompatible database type or missing uniqueness. Both migration and doctor checks use this result so they agree on the schema Ithibati can reference.

qualified(prefix, table)

Returns the table name, qualified with prefix when one is supplied, for diagnostic text.

table(repo, prefix, name)

Returns an opaque table reference, or nil when the table is absent.

types(repo, type)

Database column types compatible with a supported Ecto storage type.