return array_merge($sql,
$this->
createIndexSql($name,
$table));
} /**
* Build the SQL expression for indexes.
*/
protected function createIndexSql($tablename,
$schema) { $sql =
[];
$info =
$this->
getPrefixInfo($tablename);
if (!
empty($schema['unique keys'
])) { foreach ($schema['unique keys'
] as $key =>
$fields) { $sql[] = 'CREATE UNIQUE INDEX [' .
$info['schema'
] . '].[' .
$info['table'
] . '_' .
$key . '] ON [' .
$info['table'
] . '] (' .
$this->
createKeySql($fields) . ")\n";
} } if (!
empty($schema['indexes'
])) { foreach ($schema['indexes'
] as $key =>
$fields) { $sql[] = 'CREATE INDEX [' .
$info['schema'
] . '].[' .
$info['table'
] . '_' .
$key . '] ON [' .
$info['table'
] . '] (' .
$this->
createKeySql($fields) . ")\n";
} } return $sql;
} /**
* Build the SQL expression for creating columns.
*/