pub fn update_schema_from_raw_files(
schema: &mut Schema,
game_info: &GameInfo,
ass_kit_path: &Path,
schema_path: &Path,
tables_to_skip: &[&str],
tables_to_check: &HashMap<String, Vec<DB>>,
) -> Result<Option<HashMap<String, Vec<String>>>>Expand description
Updates an existing schema with metadata from Assembly Kit files.
This function parses Assembly Kit XML files and updates the provided schema with:
- Field types, keys, and constraints
- Foreign key relationships
- Localisable field information
- Unused field markers (via highlight flags)
- Hardcoded lookup data extracted from description columns
§Arguments
schema- The schema to update (modified in place)game_info- Game-specific information (includes Assembly Kit version)ass_kit_path- Path to the Assembly Kit installation directoryschema_path- Path where the updated schema should be savedtables_to_skip- List of table names to ignore during importtables_to_check- Map of table names to vanilla DB files for version detection
§Returns
Returns Some(HashMap) containing tables and fields that couldn’t be matched,
or None if all fields were successfully imported.
§Important Notes
- This function does not create new table definitions, it only updates existing ones
- Only the current version of each table is updated (not historical versions)
- Localisable fields are properly separated into the
localised_fieldslist - The schema is automatically saved to disk after updates
- Fields listed in the game’s
ak_lost_fieldsare not reported as unfound
§Errors
Returns an error if:
- The Assembly Kit version is unsupported
- XML files cannot be parsed
- The schema cannot be saved
§Example
ⓘ
let mut schema = Schema::load(Path::new("schemas/warhammer_3.ron"), None)?;
let supported_games = SupportedGames::default();
let game_info = supported_games.game(&KEY_WARHAMMER_3).unwrap();
let unfound = update_schema_from_raw_files(
&mut schema,
game_info,
Path::new("C:/Program Files/Steam/.../assembly_kit"),
Path::new("schemas/warhammer_3.ron"),
&[], // No tables to skip
&HashMap::new(), // Vanilla tables
)?;
if let Some(unfound_fields) = unfound {
println!("Could not match {} tables", unfound_fields.len());
}