Skip to main content

create_user_database

Function create_user_database 

Source
pub async fn create_user_database(user_id: Uuid) -> Result<String, DBError>
Expand description

Creates and migrates a dedicated database for user_id, returning its DSN.

Idempotent on the CREATE DATABASE step: a pre-existing database (SQLSTATE 42P04) is treated as success so a retried provision after a mid-way failure reuses the same deterministically-named database rather than erroring. The returned DSN is what the caller stores in users.db_name.

ยงErrors