Experimental library to compare and check SQL schemas and statements
sql-schema-comparer
allows to compare
- two SQL schemes with each other,
- a SQL statement with an SQL schema.
Therefor, sql-schema-comparer
transforms SQL statements and database definitions into a graph representation. The
graph representation is then used for comparison.
sql-schema-comparer
brings limited support for
- Database Schema Parsing
- H2 (Command-line not supported)
- SQLite
- SQL Statement Parsing
- JPA (annotations)
Two SQL schemes (databases) must only differ by one of the following transformations:
- Table
- Create
- Drop
- Rename
- Column
- Create
- Drop
- Rename
- Move
- Column Constraint
- Create
- Drop
- Foreign Key Relation
- Create
- Drop
Please refer to the [unit tests] ut to get a detailed description of how to use the library in your code.
If you want to know how sql-schema-comparer
works within an IDE, have a look on the
sql-schema-comparer eclipse plug-in.
The following examples assume that you created a stand-alone JAR.
Compare two SQLite database files
> java -jar sql-schema-comparer-standalone.jar file1.sqlite file2.sqlite
Compare an SQLite database file with an SQL statement
> java -jar sql-schema-comparer-standalone.jar -statement $STATEMENT file.sqlite
If you like to join sql-schema-comparer development you may just want to use Eclipse IDE.
Just use gradle's Eclipse plug-in with gradle eclipse
to create the necessary Eclipse
configuration files.
Happy programming! 😄
You create a stand-alone JAR with gradle: gradle standaloneJar
. You'll find the JAR in build/libs
.
Apart from the SqlStatementFrontend.java the sql-schema-comparer is released under the terms of the LGPL.
Only the SqlStatementFrontend.java is released under the terms of the GPL.