__RefactorLog table in SQL Server - safe to drop it?
Asked Answered
S

1

14

SSDT (I suspect) creates a table called __RefactorLog in any database you point it towards.

If I've hit a release is there any harm in deleting this table as I don't see any benefit in including it in schema creation scripts at the time of deployment?

I can't see any downside to it myself, but I'd like to pose the question to the knowledgeable people here to see if there's something I'm missing...

Sealer answered 25/6, 2016 at 11:57 Comment(0)
B
20

It is created by SSDT when you use a refactor in SSDT (like Refactor -> Rename) if you do a deployment and just clear out the table it will retry to do any old refactorings which could just fail or cause a disaster!

If you clear the table make sure you also remove the entries from the refactorlog.xml in your project - the file is pretty obvious.

Make sure you don't try to deploy an old dacpac (I guess this is unlikely anyway)

Ed

Boutin answered 25/6, 2016 at 13:8 Comment(2)
Ed's response is accurate. I'd just like to note that the most common "refactor" operation in an SSDT project is using the table designer to rename a column in a table. Editing the column name in the T-SQL panel is not considered a refactor operation, but editing the column name in the table designer is considered a refactor. This is a subtle, but important behavior to note.Pym
You can initiate a rename from SQL text edtitor: 1) from the designer T-SQL pane use Shift-F10 or right-click, "Refactor / Rename... ", 2) from view or SPROC use Ctrl+., just like in any other VS or VSCode editor to initiate cleanup or refactor. (response to @StevenGreen) He's correct that "normal edits" are not analyzed for possible renames.Grandmother

© 2022 - 2024 — McMap. All rights reserved.