Removed sparse fields contact_name,disable_trans from cust_branch, added branch bank...
[fa-stable.git] / sql / alter2.4.php
index 481ea817756507284cb1c66328abc1402b61b21f..5f87259ac3586a0a8afed6c5461d4b55f4e1fde5 100644 (file)
@@ -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:<br>".db_error_msg($db));
+                                       return false;
+                               }
+                       }
+
                return  update_company_prefs(array('version_id'=>$db_version));
        }
        //