Skip to content

Instantly share code, notes, and snippets.

@doctrinebot
Created December 13, 2015 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doctrinebot/651378912d529b15aa43 to your computer and use it in GitHub Desktop.
Save doctrinebot/651378912d529b15aa43 to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-175 - https://github.com/doctrine/doctrine2/issues/2399
Index: Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
===================================================================
--- Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php (revision 6806)
+++ Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php (working copy)
@@ -46,6 +46,38 @@
}
}
+ public function dropDatabase($database)
+ {
+ $params = $this->_conn->getParams();
+ $params["dbname"] = "postgres";
+ $tmpPlatform = $this->_platform;
+ $tmpConn = $this->_conn;
+
+ $this->_conn = \Doctrine\DBAL\DriverManager::getConnection($params);
+ $this->_platform = $this->_conn->getDatabasePlatform();
+
+ parent::dropDatabase($database);
+
+ $this->_platform = $tmpPlatform;
+ $this->_conn = $tmpConn;
+ }
+
+ public function createDatabase($database)
+ {
+ $params = $this->_conn->getParams();
+ $params["dbname"] = "postgres";
+ $tmpPlatform = $this->_platform;
+ $tmpConn = $this->_conn;
+
+ $this->_conn = \Doctrine\DBAL\DriverManager::getConnection($params);
+ $this->_platform = $this->_conn->getDatabasePlatform();
+
+ parent::createDatabase($database);
+
+ $this->_platform = $tmpPlatform;
+ $this->_conn = $tmpConn;
+ }
+
protected function _getPortableTriggerDefinition($trigger)
{
return $trigger['trigger_name'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment