diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-05 20:34:20 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-05 20:34:20 +0200 |
commit | b3df5c6f8cc59e099a2f1db3df8089af4abca02e (patch) | |
tree | 8b717834ab72165610b1548bb080a3299d936936 /planetwars-server/src/db/matches.rs | |
parent | 8a47b948eb88f1e0ff649880a70f9416306bac92 (diff) | |
download | planetwars.dev-b3df5c6f8cc59e099a2f1db3df8089af4abca02e.tar.xz planetwars.dev-b3df5c6f8cc59e099a2f1db3df8089af4abca02e.zip |
migrate code_bundles to bot_versions
Diffstat (limited to 'planetwars-server/src/db/matches.rs')
-rw-r--r-- | planetwars-server/src/db/matches.rs | 14 |
1 files changed, 7 insertions, 7 deletions
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<Vec<FullMatchData>> { 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::<FullMatchPlayerData>(conn)? .grouped_by(&matches); @@ -146,10 +146,10 @@ pub fn find_match(id: i32, conn: &PgConnection) -> QueryResult<FullMatchData> { 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::<FullMatchPlayerData>(conn)?; let res = FullMatchData { |