Skip to content

Add TimescaleDB hypertable support to PostgresBuilder::dropAllTables() #56280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: 12.x
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Updates to adhere to style guide
  • Loading branch information
designgears authored Jul 13, 2025
commit 0bb800203ef81acfd3e0075a1e0479d62de19a8b
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Schema/PostgresBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function dropAllTables()
$hypertables = [];

$excludedTables = $this->connection->getConfig('dont_drop') ?? ['spatial_ref_sys'];
$hasTimescaleDB = !empty($this->connection->select("SELECT 1 FROM pg_extension WHERE extname = 'timescaledb'"));
$hasTimescaleDB = ! empty($this->connection->select("SELECT 1 FROM pg_extension WHERE extname = 'timescaledb'"));

if ($hasTimescaleDB) {
$hypertables = $this->connection->select(
Expand All @@ -29,7 +29,7 @@ public function dropAllTables()
}

foreach ($this->getTables($this->getCurrentSchemaListing()) as $table) {
if (!in_array($table['name'], $excludedTables) && !in_array($table['schema_qualified_name'], $excludedTables)) {
if (! in_array($table['name'], $excludedTables) && ! in_array($table['schema_qualified_name'], $excludedTables)) {
if (in_array($table['schema_qualified_name'], $hypertables)) {
$this->connection->statement("DROP TABLE IF EXISTS {$table['schema_qualified_name']} CASCADE");
} else {
Expand Down
Loading