$tables = $this->db->query(‘SHOW TABLES’)->result();
foreach($tables as $table):
$table = $table->Tables_in_$table_name;
echo “\n\n{$table} – “;
foreach($this->db->query(“SHOW FIELDS FROM {$table}”)->result() as $column):
echo $column->Field . ‘ | ‘;
$this->db->query(“ALTER TABLE `{$table}` CHANGE `{$column->Field}` `”.strtolower(str_replace(‘ ‘, ‘_’, $column->Field)).”` “.str_replace(‘(‘,’ (‘,$column->Type));
endforeach;
endforeach;
echo “\n\nDONE\n\n”;