pub fn import(&mut self, patch: SchemaPatch) -> Result<()> {
        let game_selected = GAME_SELECTED.read().unwrap().get_game_key_name();
        match self.patches.get_mut(&game_selected) {

            // If we have patches fopr that game.
            Some(patches) => {
                let table_name = patch.tables.keys().next().unwrap();
                match patches.tables.get_mut(table_name) {

                    // If we have patches for that table.
                    Some(table_patch) => {
                        let column_name = patch.tables.get(table_name).unwrap().keys().next().unwrap();
                        table_patch.insert(column_name.to_owned(), patch.tables.get(table_name).unwrap().get(column_name).unwrap().clone());
                    }
                    None => { patches.tables.insert(table_name.to_owned(), patch.tables.get(table_name).unwrap().clone()); }
                }
            }
            None => { self.patches.insert(game_selected, patch); },
        }

        self.save()
    }
/// This function imports a schema patch into the currently loaded patchset, using the Game Selected to choose what schema to patch.
This function imports a schema patch into the currently loaded patchset, using the Game Selected to choose what schema to patch.
This function imports a schema patch into the currently loaded patchset using the Game Selected to choose what schema to patch .
pub fn import(&mut self, patch: SchemaPatch) -> Result<()> {
        let game_selected = GAME_SELECTED.read().unwrap().get_game_key_name();
        match self.patches.get_mut(&game_selected) {
            // If we have patches fopr that game.
            Some(patches) => {
                let table_name = patch.tables.keys().next().unwrap();
                match patches.tables.get_mut(table_name) {
                    // If we have patches for that table.
                    Some(table_patch) => {
                        let column_name = patch.tables.get(table_name).unwrap().keys().next().unwrap();
                        table_patch.insert(column_name.to_owned(), patch.tables.get(table_name).unwrap().get(column_name).unwrap().clone());
                    }
                    None => { patches.tables.insert(table_name.to_owned(), patch.tables.get(table_name).unwrap().clone()); }
                }
            }
            None => { self.patches.insert(game_selected, patch); },
        }
        self.save()
    }
pub fn import ( & mut self , patch : SchemaPatch ) -> Result < ( ) > { let game_selected = GAME_SELECTED . read ( ) . unwrap ( ) . get_game_key_name ( ) ; match self . patches . get_mut ( & game_selected ) { // If we have patches fopr that game. Some ( patches ) => { let table_name = patch . tables . keys ( ) . next ( ) . unwrap ( ) ; match patches . tables . get_mut ( table_name ) { // If we have patches for that table. Some ( table_patch ) => { let column_name = patch . tables . get ( table_name ) . unwrap ( ) . keys ( ) . next ( ) . unwrap ( ) ; table_patch . insert ( column_name . to_owned ( ) , patch . tables . get ( table_name ) . unwrap ( ) . get ( column_name ) . unwrap ( ) . clone ( ) ) ; } None => { patches . tables . insert ( table_name . to_owned ( ) , patch . tables . get ( table_name ) . unwrap ( ) . clone ( ) ) ; } } } None => { self . patches . insert ( game_selected , patch ) ; } , } self . save ( ) }
This function imports a schema patch into the currently loaded patchset, using the Game Selected to choose what schema to patch.
This function imports a schema patch into the currently loaded patchset using the Game Selected to choose what schema to patch .
&mut self
patch
SchemaPatch
&mut self
patch
SchemaPatch