abstract unique index creation

This commit is contained in:
Shish 2015-08-08 17:17:44 +01:00
parent 45d090054b
commit cef7257ec8

View File

@ -238,9 +238,10 @@ class SQLite extends DBEngine {
$extras = "";
foreach(explode(",", $data) as $bit) {
$matches = array();
if(preg_match("/INDEX\s*\((.*)\)/", $bit, $matches)) {
$col = $matches[1];
$extras .= "CREATE INDEX {$name}_{$col} on {$name}({$col});";
if(preg_match("/(UNIQUE)? ?INDEX\s*\((.*)\)/", $bit, $matches)) {
$uni = $matches[1];
$col = $matches[2];
$extras .= "CREATE $uni INDEX {$name}_{$col} ON {$name}({$col});";
}
else {
$cols[] = $bit;