From b3df5c6f8cc59e099a2f1db3df8089af4abca02e Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Tue, 5 Jul 2022 20:34:20 +0200 Subject: migrate code_bundles to bot_versions --- planetwars-server/src/db/matches.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'planetwars-server/src/db/matches.rs') diff --git a/planetwars-server/src/db/matches.rs b/planetwars-server/src/db/matches.rs index 54fd113..d9d893c 100644 --- a/planetwars-server/src/db/matches.rs +++ b/planetwars-server/src/db/matches.rs @@ -6,7 +6,7 @@ use diesel::{ }; use diesel::{Connection, GroupedBy, PgConnection, QueryResult}; -use crate::schema::{bots, code_bundles, match_players, matches}; +use crate::schema::{bot_versions, bots, match_players, matches}; use super::bots::{Bot, CodeBundle}; @@ -93,10 +93,10 @@ pub fn list_matches(conn: &PgConnection) -> QueryResult> { let match_players = MatchPlayer::belonging_to(&matches) .left_join( - code_bundles::table - .on(match_players::code_bundle_id.eq(code_bundles::id.nullable())), + bot_versions::table + .on(match_players::code_bundle_id.eq(bot_versions::id.nullable())), ) - .left_join(bots::table.on(code_bundles::bot_id.eq(bots::id.nullable()))) + .left_join(bots::table.on(bot_versions::bot_id.eq(bots::id.nullable()))) .load::(conn)? .grouped_by(&matches); @@ -146,10 +146,10 @@ pub fn find_match(id: i32, conn: &PgConnection) -> QueryResult { let match_players = MatchPlayer::belonging_to(&match_base) .left_join( - code_bundles::table - .on(match_players::code_bundle_id.eq(code_bundles::id.nullable())), + bot_versions::table + .on(match_players::code_bundle_id.eq(bot_versions::id.nullable())), ) - .left_join(bots::table.on(code_bundles::bot_id.eq(bots::id.nullable()))) + .left_join(bots::table.on(bot_versions::bot_id.eq(bots::id.nullable()))) .load::(conn)?; let res = FullMatchData { -- cgit v1.2.3