From 5873fa4bb0ea7889ffcdc5ed081cd7970be9e130 Mon Sep 17 00:00:00 2001 From: Avi Gupta Date: Wed, 10 Apr 2024 22:55:45 -0500 Subject: [PATCH] Deprecate old tables and switch over the rust ones --- src/database.rs | 2 +- src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/database.rs b/src/database.rs index 6fb07f8..c71961b 100644 --- a/src/database.rs +++ b/src/database.rs @@ -85,7 +85,7 @@ pub async fn fetch_usernames_sorted_by_elo( client: &Postgrest, ) -> Result, Box> { let body = client - .from("all") + .from("all_rust") .select("username") .order("elo.desc") .execute() diff --git a/src/lib.rs b/src/lib.rs index 40bab1b..b73601f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -67,9 +67,9 @@ async fn main(req: Request, env: Env, _ctx: Context) -> Result { } async fn handle_index(ctx: &RouteContext, client: &Postgrest) -> Result { - let db_name = ctx.param("db_name").map_or("all", |str| str); + let db_name = ctx.param("db_name").map_or("all", |str| str).to_string() + "_rust"; - let data = fetch_leaderboard_from_db(db_name, client) + let data = fetch_leaderboard_from_db(&db_name, client) .await .map_err(|e| format!("Couldn't fetch leaderboard from database: {e}"))?;