This:
$sql = mysqli_query($dbConn,"SHOW TABLES");
$tables=array();
while($table_row = mysqli_fetch_array($sql))
{
$tables[]=$table_row[0];
}
foreach($tables as $table){
$sql = mysqli_query($dbConn,"SHOW COLUMNS FROM ".$table);
$query = "ALTER TABLE ".$table;
while($column_row = mysqli_fetch_array($sql))
{
if(substr($column_row['Field'],-3)=="_ID"){
$new_column = strtolower(substr($column_row['Field'],0,-3))."_ID";
}
else
{
$new_column = strtolower($column_row['Field']);
}
$query .= " CHANGE COLUMN ". " " .$column_row['Field']." ".$new_column. " " . $column_row['Type'] . " " . (($column_row['Null']=='YES')?'NULL':'NOT NULL') . " " . (($column_row['Default']=='')?'':' DEFAULT '.$column_row['Default']) . " " . $column_row['Extra'] . ",";
}
$query = rtrim($query,',');
echo $query;
echo "<br><br><br>";
}
Will give you a list of all the ALTER TABLE statements for each column in each table.
Warning:
I've made the above query to print all the ALTER statements on screen, however, it's upto you to decide whether to execute it or not. I'm not sure whether your database will remain the same after executing them because they may not cover all the possible data types and conditions you have selected for each column.
Do the above, it won't make the changes to your database and see if any of your columns are missing any significant datatype or conditional value.