Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/Sql/SqlPgsql.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,20 @@ public function createdb(bool $quoted = false): ?bool

public function drop(array $tables): ?bool
{
$return = true;
if ($tables) {
$sql = 'DROP TABLE ' . implode(', ', $tables) . ' CASCADE';
$return = $this->query($sql);
$return = $this->alwaysQuery('DROP SCHEMA public CASCADE');
if ($return) {
$return = $this->alwaysQuery('CREATE SCHEMA public');
}
if ($return) {
$dbSpec = $this->getDbSpec();
$username = $dbSpec['username'] ?? 'public';
$this->alwaysQuery("GRANT ALL ON SCHEMA public TO {$username}");
$this->alwaysQuery('GRANT ALL ON SCHEMA public TO public');
}
return $return;
}
return $return;
return true;
}

public function createdbSql($dbname, $quoted = false): string
Expand Down