18 lines
331 B
Rust
18 lines
331 B
Rust
use sqlx::PgPool;
|
|
use uuid::Uuid;
|
|
|
|
pub async fn ensure_user_exists(pool: &PgPool, user_id: Uuid) -> Result<(), sqlx::Error> {
|
|
sqlx::query!(
|
|
r#"
|
|
INSERT INTO auth.app_user (id)
|
|
VALUES ($1)
|
|
ON CONFLICT (id) DO NOTHING
|
|
"#,
|
|
user_id
|
|
)
|
|
.execute(pool)
|
|
.await?;
|
|
|
|
Ok(())
|
|
}
|