The Diff Panel allows you to compare different documents, or different versions of the same document.
The Diff Panel appears in the lower section of the Document Sidebar.
How to use the Diff Panel
To use the diff panel, make sure the document sidebar is open, then click the diff icon in the Source Sidebar Tab Section
Use the Compare Target Menu to specify which document or snapshot you want to compare against
The dialect is the same as that used in the document. You can change the dialect for the document in this panel using the Dialect Menu
What you can compare against
- Any other document currently open in SQLEditor
-
As Loaded - The current document as it was originally opened
-
As Last Database Export - The state when the current document was exported to a database.
(But only since it was opened, this won't persist)
Currently you cannot directly compare against a running database.
If you want to compare with a database you need to use import the database into a temporary document using →Import from Database....
Then switch to your main document and compare against the temporary document that you just created. (We hope to improve this in future)
Direction of Comparison
The current document is considered the "end" state, you specify which document was the "start" state.
SQLEditor then calculates the changes required to modify the "start" document to match the current "end" document.
The changes are shown in the output area.
Different dialects support different levels of diff. SQLite for example requires a complete table rebuild for anything other than adding columns. Other databases may require setting of primary or foreign key names before a suitable drop statement can be generated