22use Doctrine\DBAL\Schema\Schema;
33 private function addTableToSchema( Schema $schema, array $schemaSpec ) {
34 $prefix = $this->platform->getName() ===
'postgresql' ?
'' :
'/*_*/';
36 $table = $schema->createTable( $prefix . $schemaSpec[
'name'] );
37 foreach ( $schemaSpec[
'columns'] as $column ) {
38 $table->addColumn( $column[
'name'], $column[
'type'], $column[
'options'] );
41 foreach ( $schemaSpec[
'indexes'] as $index ) {
42 if ( $index[
'unique'] ===
true ) {
43 $table->addUniqueIndex( $index[
'columns'], $index[
'name'], $index[
'options'] ?? [] );
45 $table->addIndex( $index[
'columns'], $index[
'name'], $index[
'flags'] ?? [], $index[
'options'] ?? [] );
49 if ( isset( $schemaSpec[
'pk'] ) && $schemaSpec[
'pk'] !== [] ) {
50 $table->setPrimaryKey( $schemaSpec[
'pk'] );
53 if ( isset( $schemaSpec[
'table_options'] ) ) {
54 $table->addOption(
'table_options', implode(
' ', $schemaSpec[
'table_options'] ) );
56 $table->addOption(
'table_options',
'/*$wgDBTableOptions*/' );