last,
next,
previous,
first change
all,
none,
invert selection on the left,
all,
none,
invert selection on the right side
left selected items to the right side,
right selected items to the left side
selected items on the right side,
selected items on the right side
Export to Xlsx or JsonThis tab allows to compare definition of particular table:
Tab is divided into 3 major collapsible sections (Columns, Constraints and Options) and bottom panel for selected item details. Here is explanation of changes highlight annotation on the above screenshot:
Vertical toolbar between two panels contains additional tab-specific actions:
Open data diff for the current table
Open data diff for the current table filtered only to new and changed records
opens query result diff with select top 1000 records statement for this table
'Open table definition as text' opens text diff tab with table script generated by application
'Open table definition from sqlite_master' opens text diff tab with table script provided by SQLite metadataOptions section shows STRICT and/or WITHOUT ROWID if any defined for table.
Constraints section includes PRIMARY KEY, UNIQUE, CHECK and FOREIGN KEY constraints - any constraint which can be defined on table level (like CREATE TABLE T(A, B, UNIQUE (A, B))), even if it was defined on column level (like CREATE TABLE T(A UNIQUE, B)). Constraints that can be defined only on column level (NOT NULL and DEFAULT) - they are presented in the Columns grid. UI does not show on which level constraint is defined (table or column), but 1) this can be checked using
'Open definition as text' command, and 2) application knows this level and tries to keep it during merge.
Constraints Columns column is either column on which it is defined (for column-level constraints), or it is columns listed explicitely in the table-level constraint definition for PRIMARY KEY, UNIQUE and FOREIGN KEY constraints. For table-level CHECK contraints Columns are not populated - related columns can be found in the CHECK expression in the Definition column.
It's pretty straightforward to identify column or option - whether it is the same or not, and therefore whether it is new, changed or unchanged. Columns and options are identified by their names. But for constraints it is not so trivial, there is no such kind of identifier. Application uses the following rules to identify constraint and understand whether it is new or changed:
Merge/delete actions use modified version of 12-steps method described in ALTER TABLE article from SQLite documentation. Here are these modifications:
PRAGMA foreign_key_check is used for the re-created table and for tables that reference it. If it finds any problem, the merge fails and all changes of this table are rolled back. After commit foreign keys are enabled again.
sqlite_sequence. Otherwise dropping the old table resets the counter, and ids of rows deleted before the merge could be used again.rowid is copied with the other columns, so rows keep their rowids. Otherwise the new table numbers rows from 1 and gaps left by deleted rows disappear. It is not copied for WITHOUT ROWID tables and for tables with a real column named rowid.FROM a, t or main.t), and also views that use such views. As a side effect, an object that only has the same name in its text (for example a column with the name of the table) is also dropped and re-created, without changes.Merge/delete actions may fail because of limitations caused by other objects such as foreign keys, existing data, DB engine limitations and so on. For example, new NOT NULL column without DEFAULT constraints can not be merged to the table with records - obvoiusly because these records will have no data in the new column and this will break NOT NULL constraint. Please check merge execution result for details.
If any new column with new constraints is selected without these constraints and then Merge action happens - then this column is merged without these constraints (it is a valid operation). But if new constraint for new column is selected without its column - then it is merged with that new column (otherwise it would be an invalid operation).
At the top right corner of each panel, the tab can show a red warning about the table on this side. The same tables are marked with
in the Object list, and merge or delete of such table shows a warning in the Execute script dialog.
PRAGMA table_info. It returns only column name, type, NOT NULL, DEFAULT and primary key, so other constraints, COLLATE, AUTOINCREMENT and generated columns are not available.Merge/delete actions build the script from the table definition shown in this tab, not from the original CREATE TABLE text. So comments and the parts that the application could not read are not included in the script, and when the table is re-created, they are lost in the target table. To check the original text of an incomplete table, use
'Open table definition from sqlite_master' and compare it with
'Open table definition as text', which shows the definition read by the application.