From 922f00e339b86bb5091a0aa94d90b6bfe7ef54b9 Mon Sep 17 00:00:00 2001 From: George Wu Date: Sat, 21 Feb 2026 17:49:36 -0800 Subject: [PATCH] fix: remove uuid cast from storage usage query The user_id column in storage.files is varchar, not uuid. The ::uuid cast was causing a type mismatch error when calculating storage usage. --- src/application/services/storage_usage_service.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/application/services/storage_usage_service.rs b/src/application/services/storage_usage_service.rs index 4413bcba..c2e8d405 100644 --- a/src/application/services/storage_usage_service.rs +++ b/src/application/services/storage_usage_service.rs @@ -57,11 +57,12 @@ impl StorageUsageService { // Direct SQL query to sum all file sizes for this user // This is much more efficient than recursively walking folders + // Note: user_id is stored as varchar, not uuid, so we bind it directly as text let total_size: i64 = sqlx::query_scalar( r#" SELECT COALESCE(SUM(size), 0)::bigint FROM storage.files - WHERE user_id = $1::uuid AND NOT is_trashed + WHERE user_id = $1 AND NOT is_trashed "#, ) .bind(user_id)