Migrate install rewriting to new rewriters

This commit is contained in:
Matthew Bucci committed 2023-11-07 15:26:03 -08:00
1 parent 3754ae32e4
commit c60d8f90b1
11 files changed
+487 -349

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
<?php
class DropTableSQLRewriter extends AbstractSQLRewriter
{
public function rewrite(): string
{
$sql = $this->original();
$pattern = '/DROP TABLE.+ [`]?(\w+)[`]?$/';
preg_match($pattern, $sql, $matches);
$table = $matches[1];
$seq = $table . '_seq';
$sql .= ";\nDROP SEQUENCE IF EXISTS $seq;";
return $sql;
}
}