diff --git a/Procfile.postgrest b/Procfile.postgrest new file mode 100644 index 0000000000..acab58e086 --- /dev/null +++ b/Procfile.postgrest @@ -0,0 +1,2 @@ +app: postgrest crates/collab/postgrest_app.conf +llm: postgrest crates/collab/postgrest_llm.conf diff --git a/crates/collab/postgrest_app.conf b/crates/collab/postgrest_app.conf new file mode 100644 index 0000000000..3a0cdfa493 --- /dev/null +++ b/crates/collab/postgrest_app.conf @@ -0,0 +1,4 @@ +db-uri = "postgres://postgres@localhost/zed_llm" +server-port = 8082 +jwt-secret = "the-postgrest-jwt-secret-for-authorization" +log-level = "info" diff --git a/crates/collab/admin_api.conf b/crates/collab/postgrest_llm.conf similarity index 100% rename from crates/collab/admin_api.conf rename to crates/collab/postgrest_llm.conf diff --git a/crates/collab/src/llm/db/queries/usages.rs b/crates/collab/src/llm/db/queries/usages.rs index 206e5d39ab..6ea7439811 100644 --- a/crates/collab/src/llm/db/queries/usages.rs +++ b/crates/collab/src/llm/db/queries/usages.rs @@ -173,12 +173,16 @@ impl LlmDatabase { let users_in_recent_minutes = usage::Entity::find() .filter(usage::Column::Timestamp.gte(minute_since.naive_utc())) + .select_only() + .column(usage::Column::UserId) .group_by(usage::Column::UserId) .count(&*tx) .await? as usize; let users_in_recent_days = usage::Entity::find() .filter(usage::Column::Timestamp.gte(day_since.naive_utc())) + .select_only() + .column(usage::Column::UserId) .group_by(usage::Column::UserId) .count(&*tx) .await? as usize;