Update database.php

This commit is contained in:
Namhyeon Go 2019-12-31 17:03:45 +09:00 committed by GitHub
parent ca4a0d7a37
commit 50cc0d6207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -770,6 +770,7 @@ if(!check_function_exists("exec_db_table_create")) {
// get index options
$config = get_config();
$setindex = get_value_in_array("setindex", $options, false);
$setunique = get_value_in_array("setunique", $options, false);
// check if exists table
$bind = array(
@ -817,6 +818,12 @@ if(!check_function_exists("exec_db_table_create")) {
$sql = sprintf("create index `%s` on `%s` (%s)", $k, $_tablename, implode(", ", $v));
exec_db_query($sql);
}
// create unique (type of index)
foreach($setunique as $k=>$v) {
$sql = sprintf("create unique index `%s` on `%s` (%s)", $k, $_tablename, implode(", ", $v));
exec_db_query($sql);
}
}
return $_tablename;