diff --git a/src/service_identity.rs b/src/service_identity.rs --- a/src/service_identity.rs +++ b/src/service_identity.rs @@ -51,8 +51,6 @@ pub plc_verified: bool, pub setup_complete: bool, } -// Row type: (mode, did, signing_key_enc, setup_complete, created_at, updated_at) -// setup_complete uses i32 because sqlx's Any driver can't decode SQLite BOOLEAN directly. type ServiceIdentityRow = (String, Option, Option, i32, String, String); fn parse_row(r: ServiceIdentityRow) -> Result { @@ -132,7 +130,7 @@ ) -> Result<(), AppError> { let now = chrono::Utc::now().to_rfc3339(); let sql = adapt_sql( "INSERT INTO service_identity (id, mode, did, signing_key_enc, rotation_key_enc, attached_account_did, setup_complete, created_at, updated_at) - VALUES (1, ?, ?, ?, ?, ?, ?, ?, ?) + VALUES (1, ?, ?, ?, ?, ?, FALSE, ?, ?) ON CONFLICT (id) DO UPDATE SET mode = excluded.mode, did = excluded.did, @@ -150,7 +148,6 @@ .bind(did) .bind(signing_key_enc) .bind(rotation_key_enc) .bind(attached_account_did) - .bind(0i32) .bind(&now) .bind(&now) .execute(db) @@ -164,12 +161,11 @@ /// Mark setup as complete for the service identity row. pub async fn mark_setup_complete(db: &AnyPool, backend: DatabaseBackend) -> Result<(), AppError> { let now = chrono::Utc::now().to_rfc3339(); let sql = adapt_sql( - "UPDATE service_identity SET setup_complete = ?, updated_at = ? WHERE id = 1", + "UPDATE service_identity SET setup_complete = TRUE, updated_at = ? WHERE id = 1", backend, ); sqlx::query(&sql) - .bind(1i32) .bind(&now) .execute(db) .await