Prevent overwriting of base game cells is_base_game value

This fixes a bug that was causing cell data to not get written since
November 9th, 2023. When batch inserting cells while processing plugins,
I allowed overwriting cells that had `is_base_game = true`. Since I
always set `is_base_game = false` for cell upserts from plugins, this
was causing the base game cells to revert to `is_base_game = false`. All
it took was one mod to bundle `Skyrim.esm` for this to happen.

This broke writing cell data since `get_cell_data` depends on the
`is_base_game` value to find edits to the Skyrim base game cells.

To prevent this in the future, batch inserts when processing plugins is
no longer allowed to update cells which have `is_base_game = true`. The
only time we allow upserting these rows is when running the
`is_base_game` backfill which initially seeds the database with the base
game cells.
This commit is contained in:
2025-03-02 14:15:05 -05:00
parent a5135b30f4
commit a677325c4d
4 changed files with 62 additions and 31 deletions

View File

@@ -128,7 +128,7 @@ pub async fn process_plugin(
}
})
.collect();
let db_cells = cell::batched_insert(&pool, &cells).await?;
let db_cells = cell::batched_insert(&pool, &cells, false).await?;
let plugin_cells: Vec<UnsavedPluginCell> = db_cells
.iter()
.zip(&plugin.cells)