diff --git a/integration-tests/engines.js b/integration-tests/engines.js index eb14d8c4..011af637 100644 --- a/integration-tests/engines.js +++ b/integration-tests/engines.js @@ -188,8 +188,8 @@ const filterLocal = [ // filter local testing '-MySQL', '-MariaDB', - 'PostgreSQL', - '-SQL Server', + '-PostgreSQL', + 'SQL Server', '-SQLite', '-CockroachDB', '-ClickHouse', diff --git a/packages/tools/src/diffTools.ts b/packages/tools/src/diffTools.ts index 8e6222a3..ecccef9e 100644 --- a/packages/tools/src/diffTools.ts +++ b/packages/tools/src/diffTools.ts @@ -647,10 +647,19 @@ export function createAlterDatabasePlan( } else if (!opts.noDropSqlObject) { plan.dropSqlObject(oldobj); } - } else if (!testEqualSqlObjects(oldobj, newobj, opts)) { - plan.recreates.sqlObjects += 1; - plan.dropSqlObject(oldobj); - plan.createSqlObject(newobj); + } else { + if ( + opts.deletedSqlObjectPrefix && + driver.dialect.renameSqlObject && + hasDeletedPrefix(oldobj.pureName, opts, opts.deletedSqlObjectPrefix) + ) { + plan.dropSqlObject(oldobj); + plan.createSqlObject(newobj); + } else if (!testEqualSqlObjects(oldobj, newobj, opts)) { + plan.recreates.sqlObjects += 1; + plan.dropSqlObject(oldobj); + plan.createSqlObject(newobj); + } } } }