Migrate install rewriting to new rewriters

This commit is contained in:
Matthew Bucci
2023-11-07 15:26:03 -08:00
parent 3754ae32e4
commit c60d8f90b1
11 changed files with 487 additions and 349 deletions
+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;
}
}