diff --git a/src/main.rs b/src/main.rs index 93f156f..0c61dc5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -256,7 +256,8 @@ pub async fn main() -> Result<()> { let page_size = 20; let mut last_id = None; loop { - let mods = game_mod::batched_get_with_cells(&pool, page_size, last_id).await?; + let mods = game_mod::batched_get_with_cells(&pool, page_size, last_id, "Skyrim.esm", 1) + .await?; if mods.is_empty() { break; } diff --git a/src/models/game_mod.rs b/src/models/game_mod.rs index d4f1096..6ca1320 100644 --- a/src/models/game_mod.rs +++ b/src/models/game_mod.rs @@ -355,6 +355,8 @@ pub async fn batched_get_with_cells( pool: &sqlx::Pool, page_size: i64, last_id: Option, + master: &str, + world_id: i32, ) -> Result> { let last_id = last_id.unwrap_or(0); sqlx::query_as!( @@ -365,12 +367,14 @@ pub async fn batched_get_with_cells( FROM mods LEFT OUTER JOIN plugin_cells ON plugin_cells.mod_id = mods.id LEFT OUTER JOIN cells ON cells.id = plugin_cells.cell_id - WHERE mods.id > $2 + WHERE mods.id > $2 AND cells.master = $3 AND cells.world_id = $4 GROUP BY mods.id ORDER BY mods.id ASC LIMIT $1", page_size, last_id, + master, + world_id ) .fetch_all(pool) .await