33 lines
1013 B
PHP
33 lines
1013 B
PHP
<?php
|
|
require_once 'core/main.php';
|
|
|
|
$query_converter = $db->query("SELECT CONCAT('ALTER TABLE ', TABLE_NAME, ' CHANGE `', COLUMN_NAME, '` `',
|
|
LOWER(COLUMN_NAME), '` ', COLUMN_TYPE, ';') as query
|
|
FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'simrs_dev'");
|
|
|
|
$arr_error = [];
|
|
$arr_success = [];
|
|
foreach($query_converter->fetchAll() as $item)
|
|
{
|
|
// echo '<pre>',dd($item),'</pre>';
|
|
if(preg_match("/t_sep|t_lis_registration|t_lis_regorderitem|t_lis_result|t_lis_result_note|temp_tmlogbarang|temp_tmlogbarangstock|temp_tmlogreference|temp_ttlogmutasibarang|tmlogbarang|tmlogbarangstock|tmlogreference|ttlogjual|ttlogjuald|ttlogmutasibarang|v_demographics/", $item['query'])) {
|
|
continue;
|
|
}
|
|
$exe = $db->query($item['query']);
|
|
if(!$exe)
|
|
{
|
|
$arr_error[] = 'Ada masalah pada query '.$item['query'];
|
|
}
|
|
else {
|
|
$arr_success[] = $item['query'];
|
|
}
|
|
}
|
|
|
|
if(empty($arr_error)){
|
|
echo 'Rename kolom lowercase berhasil';
|
|
echo '<pre>',dd($arr_success),'</pre>';
|
|
}
|
|
else {
|
|
echo 'Rename kolom lowercase gagal';
|
|
}
|
|
?>
|