Update database.php

This commit is contained in:
Namhyeon Go 2020-04-16 16:20:38 +09:00 committed by GitHub
parent 2745ede24a
commit 65135d36a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -985,6 +985,20 @@ if(!is_fn("exec_db_table_create")) {
$settimefield = get_value_in_array("settimefield", $options, false);
$setexpire = get_value_in_array("setexpire", $options, false);
// check before options
$before = get_value_in_array("before", $options, false);
if(is_array($before)) {
foreach($before as $v) {
if($v == "truncate") {
$sql = sprintf("truncate `%`", $_tablename);
exec_db_query($sql);
} elseif($v == "auto_increment_1") {
$sql = sprintf("alter table `%s` AUTO_INCREMENT = 1", $_tablename);
exec_db_query($sql);
}
}
}
// check if exists table
$bind = array(
"TABLE_SCHEMA" => $config['db_name'],