public function updateDBFromStructure($structure, $safeUpdate = true) {
        $diffs = $this->getDifferenceSQL($structure);
        if ($diffs['result'] === true) {
            QC::executeSQL('SET FOREIGN_KEY_CHECKS = 0');
            if (!empty($diffs['sql']['ADD'])) QC::executeArrayOfSQL($diffs['sql']['ADD']);
            if (!empty($diffs['sql']['CHANGE'])) QC::executeArrayOfSQL($diffs['sql']['CHANGE']);
            if (!empty($diffs['sql']['DROP']) && !$safeUpdate) QC::executeArrayOfSQL($diffs['sql']['DROP']);
        }
    }
public function updateDBFromStructure($structure, $safeUpdate = true) {
        $diffs = $this->getDifferenceSQL($structure);
        if ($diffs['result'] === true) {
            QC::executeSQL('SET FOREIGN_KEY_CHECKS = 0');
            if (!empty($diffs['sql']['ADD'])) QC::executeArrayOfSQL($diffs['sql']['ADD']);
            if (!empty($diffs['sql']['CHANGE'])) QC::executeArrayOfSQL($diffs['sql']['CHANGE']);
            if (!empty($diffs['sql']['DROP']) && !$safeUpdate) QC::executeArrayOfSQL($diffs['sql']['DROP']);
        }
    }
public function updateDBFromStructure ( $ structure , $ safeUpdate = true ) { $ diffs = $ this -> getDifferenceSQL ( $ structure ) ; if ( $ diffs [ 'result' ] === true ) { QC :: executeSQL ( 'SET FOREIGN_KEY_CHECKS = 0' ) ; if ( ! empty ( $ diffs [ 'sql' ] [ 'ADD' ] ) ) QC :: executeArrayOfSQL ( $ diffs [ 'sql' ] [ 'ADD' ] ) ; if ( ! empty ( $ diffs [ 'sql' ] [ 'CHANGE' ] ) ) QC :: executeArrayOfSQL ( $ diffs [ 'sql' ] [ 'CHANGE' ] ) ; if ( ! empty ( $ diffs [ 'sql' ] [ 'DROP' ] ) && ! $ safeUpdate ) QC :: executeArrayOfSQL ( $ diffs [ 'sql' ] [ 'DROP' ] ) ; } }
Update database from array
@param mixed|ModelStructure $structure
@param bool $safeUpdate if true - method will delete not specified fields
@throws \Exception
Update database from array