Merge ".mailmap: Correct two contributor names"
[mediawiki.git] / includes / installer / PostgresDatabaseCreator.php
blob04d186a5014bc1b7cb1d67193f8eb9fa4c0deb1b
1 <?php
3 namespace MediaWiki\Installer;
5 use MediaWiki\Status\Status;
6 use Wikimedia\Rdbms\IDatabase;
8 class PostgresDatabaseCreator extends NetworkedDatabaseCreator {
9 protected function existsInConnection( IDatabase $conn, $database ) {
10 return (bool)$conn->selectField( 'pg_catalog.pg_database', '1',
11 [ 'datname' => $database ], __METHOD__ );
14 protected function createInConnection( IDatabase $conn, $database ): Status {
15 $safedb = $conn->addIdentifierQuotes( $database );
16 $conn->query( "CREATE DATABASE $safedb", __METHOD__ );
17 return Status::newGood();