Migrate install rewriting to new rewriters
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user