SQL 服务器数据工具忽略模式比较重构

SQL Server Data Tools Ignores Refactor on Schema Compare

我遇到的问题与此处描述的问题看似相同:SSDT Refactor Rename is ignored by the Schema Comparison script generation. Essentially, the refactor component of SQL Server Data Tools is not working on schema comparison/update. Instead of renaming a table, for instance, the table with the old name is dropped and the table with the new name is created. Unfortunately, I do not see an accepted answer to that question. I found a similar question, which seems to be have been asked by the same person on MSDN; see: Refactor Rename is ignored by the Schema Comparison script generation。同样,它看起来不像是提出了可接受的答案。我真的很想弄清楚如何让这个功能发挥作用。有人有想法吗?

找出问题的原因。我注意到,在对我的 SQL Data Tools 项目和一个不同的(但本质上相同的)数据库进行模式比较时,重构组件 实际上被 考虑了。我查看了生成的 SQLCMD 脚本,在底部看到了很多看起来像这样的条目...... IF NOT EXISTS (SELECT OperationKey FROM [dbo].[__RefactorLog] WHERE OperationKey = 'ce3d4c93-c1c4-4967-9cd5-0048d1e7d22f') INSERT INTO [dbo].[__RefactorLog] (OperationKey) values ('ce3d4c93-c1c4-4967-9cd5-0048d1e7d22f')

我查看了我遇到问题的数据库,果然,在 SS MS 的系统表下,我找到了 dbo.__RefactorLog。截断此 table 后,架构比较再次显示正确的重构。