X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sql%2Falter2.4.php;h=c51f19962c7a347ee82d4abbafa951006674b8be;hb=a771b6cb35770f7b8b5087caf923aeec8fbefe96;hp=481ea817756507284cb1c66328abc1402b61b21f;hpb=13367be8aaf5175295f7aab7160370458dad1824;p=fa-stable.git diff --git a/sql/alter2.4.php b/sql/alter2.4.php index 481ea817..c51f1996 100644 --- a/sql/alter2.4.php +++ b/sql/alter2.4.php @@ -50,6 +50,20 @@ class fa2_4 { if ($result) $result = $this->do_cleanup(); + //remove obsolete and temporary columns. + // this have to be done here as db_import rearranges alter query order + $dropcol = array( + 'cust_branch' => array('contact_name', 'disable_trans'), + ); + + foreach($dropcol as $table => $columns) + foreach($columns as $col) { + if (db_query("ALTER TABLE `".TB_PREF."{$table}` DROP `$col`")==false) { + display_error("Cannot drop {$table}.{$col} column:
".db_error_msg($db)); + return false; + } + } + return update_company_prefs(array('version_id'=>$db_version)); } // @@ -132,7 +146,7 @@ class fa2_4 { // site default encoding is presumed as encoding for all databases! $lang = array_search_value($dflt_lang, $installed_languages, 'code'); $new_encoding = get_mysql_encoding_name(strtoupper($lang['encoding'])); - // get_usec(); + if ($test) error_log('Switching database to utf8 encoding from '.$old_encoding); $collation = get_mysql_collation(); @@ -140,7 +154,6 @@ class fa2_4 { $tresult = db_query($tsql, "Cannot select all tables with prefix '$pref'"); while($tbl = db_fetch($tresult)) { $table = $tbl[0]; - // if ($table != '1_chart_master') continue; _vd($table); get_usec(); // fast debug on single table db_query("ALTER TABLE `$table` CONVERT TO CHARACTER SET $old_encoding"); // convert encoding on utf-8 tables