MediaWiki  master
DoctrineSchemaBuilderFactory.php
Go to the documentation of this file.
1 <?php
2 namespace Wikimedia\Rdbms;
3 
4 use Doctrine\DBAL\Platforms\MySqlPlatform;
5 use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
6 use Doctrine\DBAL\Platforms\SqlitePlatform;
7 use InvalidArgumentException;
8 
14 
19  public function getSchemaBuilder( $platform ) {
20  if ( $platform === 'mysql' ) {
21  $platformObject = new MySqlPlatform();
22  } elseif ( $platform === 'postgres' ) {
23  $platformObject = new PostgreSqlPlatform();
24  } elseif ( $platform === 'sqlite' ) {
25  $platformObject = new SqlitePlatform();
26  } else {
27  throw new InvalidArgumentException( 'Unknown platform: ' . $platform );
28  }
29 
30  return new DoctrineSchemaBuilder( $platformObject );
31  }
32 }
Wikimedia\Rdbms
Definition: ChronologyProtector.php:24
Wikimedia\Rdbms\DoctrineSchemaBuilder
@experimental @unstable
Definition: DoctrineSchemaBuilder.php:11
Wikimedia\Rdbms\DoctrineSchemaBuilderFactory
@experimental @unstable
Definition: DoctrineSchemaBuilderFactory.php:13
Wikimedia\Rdbms\DoctrineSchemaBuilderFactory\getSchemaBuilder
getSchemaBuilder( $platform)
Definition: DoctrineSchemaBuilderFactory.php:19