pgrewrite should not remove IF NOT EXISTS

This commit is contained in:
mattbucci
2024-01-08 04:13:06 +00:00
parent 200dfaa0b2
commit aca566b8bf
2 changed files with 30 additions and 2 deletions
+2 -2
View File
@@ -39,9 +39,9 @@ class CreateTableSQLRewriter extends AbstractSQLRewriter
$sql = $this->original();
$sql = str_replace('CREATE TABLE IF NOT EXISTS ', 'CREATE TABLE ', $sql);
$tableSQL = str_replace('CREATE TABLE IF NOT EXISTS ', 'CREATE TABLE ', $sql);
$pattern = '/CREATE TABLE [`]?(\w+)[`]?/';
preg_match($pattern, $sql, $matches);
preg_match($pattern, $tableSQL, $matches);
$table = $matches[1];
// Remove trailing spaces