Home Files: Importing and Exporting

# Exporting to a SQL Diff

Sometimes you may have an existing database, but need to make some changes. For example you might wish to add a column to a table. SQLEditor can help you with by generating a diff. A diff is a series of SQL instructions that alter the existing database to a new state.

To generate a diff you will normally need two documents, the first representing the initial state, the second representing the required state. Both need to be open in SQLEditor. You cannot currently compare against a document unless it is open, nor can time-machine or versions documents be used.

SQLEditor also allows you to generate a diff between the current state of a document and a snapshot of the current document when it was most recently loaded. SQLEditor automatically creates a snapshot of each document when loaded for comparison. Note however that if you close a document, any snapshots will be lost. So if you need to do more than a simple one-off comparison, you should save a copy of the document first and compare against that.

1. Make sure that both current and initial state documents are open in SQLEditor
2. Choose File→Export diff...
3. Choose the export dialect that matches the database system that you are using
4. Choose the document or snapshot representing the initial state that you want to generate the diff against.
5. Click Export