mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/11295] Drop tables rather than database for postgres in test suite.
Doing so allows: 1. User running the tests no longer needs create database privilege. 2. Test database may be located in a non-default tablespace and generally have site-specific options applied to it. PHPBB3-11295
This commit is contained in:
parent
c701de695f
commit
02a1777fcb
1 changed files with 25 additions and 2 deletions
|
@ -186,6 +186,16 @@ class phpbb_database_test_connection_manager
|
|||
$this->purge_extras();
|
||||
break;
|
||||
|
||||
case 'postgres':
|
||||
$this->connect();
|
||||
// Drop all of the tables
|
||||
foreach ($this->get_tables() as $table)
|
||||
{
|
||||
$this->pdo->exec('DROP TABLE ' . $table . ' CASCADE');
|
||||
}
|
||||
$this->purge_extras();
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->connect(false);
|
||||
|
||||
|
@ -419,6 +429,19 @@ class phpbb_database_test_connection_manager
|
|||
$queries[] = 'DROP SEQUENCE ' . current($row);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'postgres':
|
||||
$sql = 'SELECT sequence_name
|
||||
FROM information_schema.sequences';
|
||||
$result = $this->pdo->query($sql);
|
||||
|
||||
while ($row = $result->fetch(PDO::FETCH_NUM))
|
||||
{
|
||||
$queries[] = 'DROP SEQUENCE ' . current($row);
|
||||
}
|
||||
|
||||
$queries[] = 'DROP TYPE IF EXISTS varchar_ci CASCADE';
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($queries as $query)
|
||||
|
|
Loading…
Add table
Reference in a new issue