mirror of
https://github.com/yiisoft/yii2.git
synced 2026-03-06 15:28:58 +01:00
Fix #17667: Fix CREATE INDEX failure on sqlite when specifying schema
This commit is contained in:
committed by
GitHub
parent
4de66f8205
commit
438cc80fc7
@@ -545,4 +545,22 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
||||
|
||||
return trim($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createIndex($name, $table, $columns, $unique = false)
|
||||
{
|
||||
$tableParts = explode('.', $table);
|
||||
|
||||
$schema = null;
|
||||
if (count($tableParts) === 2) {
|
||||
list ($schema, $table) = $tableParts;
|
||||
}
|
||||
|
||||
return ($unique ? 'CREATE UNIQUE INDEX ' : 'CREATE INDEX ')
|
||||
. $this->db->quoteTableName(($schema ? $schema . '.' : '') . $name) . ' ON '
|
||||
. $this->db->quoteTableName($table)
|
||||
. ' (' . $this->buildColumns($columns) . ')';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user