In the 0.8.7 release, DiffKit gained the ability to generate database "patches". These patches are analogous to the patch files produced by traditional *nix diff tools-- they can be read by a patching tool in order to edit the RHS so that it is identical to the LHS.
diff tool | patch format | patch tool | |
---|---|---|---|
DiffKit | diffkit-app | sql DML | any DML applicator |
Diffutils | diff | unidiff | patch |
The "patch" files produced by DiffKit contain only INSERT, DELETE, and UPDATE statements. After the user applies those DML statements to the RHS table, using whichever tools and techniques they prefer, the RHS table will have identical contents to the LHS table. The DiffKit application will never directly modify your tables-- DiffKit is strictly a read-only application from the perspective of your table data.
DB patches are created by using a new Sink implementation: the SqlPatchSink. test26.plan.xml, in the eg/ (examples) folder, dmonstrates this:
test26.plan.xml
... <property name="sqlPatchFilePath" value="./test26.sink.patch" /> ...
invoked this way:
java -jar ../diffkit-app.jar -planfiles test26.plan.xml,dbConnectionInfo.xml
produces this output in the patch file:
test26.sink.patch
DELETE FROM PUBLIC.TEST26_RHS_TABLE WHERE (COLUMN1='1' ); INSERT INTO PUBLIC.TEST26_RHS_TABLE (COLUMN1, COLUMN2, COLUMN3, COLUMN4) VALUES ('2', 'xxxx', 2, 'zz2zz'); UPDATE PUBLIC.TEST26_RHS_TABLE SET COLUMN3=3 WHERE (COLUMN1='3' ); UPDATE PUBLIC.TEST26_RHS_TABLE SET COLUMN2='5555', COLUMN3=4, COLUMN4='zz4zz' WHERE (COLUMN1='4' ); INSERT INTO PUBLIC.TEST26_RHS_TABLE (COLUMN1, COLUMN2, COLUMN3, COLUMN4) VALUES ('5', 'xxxx', 5, 'zz5zz'); DELETE FROM PUBLIC.TEST26_RHS_TABLE WHERE (COLUMN1='6' );