-
Notifications
You must be signed in to change notification settings - Fork 0
DbMigrate
Excursion: [Why use dbmigrate and who can use it?](DBMigrate Why)
You can use the dbmigrate tool to manage the creation and evolution of one or more databases. It supports postgres, mysql and oracle explicitly, but should run with any JDBC database. With this tool, you can set up a project with scripts (e.g. SQL) to create the database and put upgrade scripts into another directory to upgrade to a newer schema version.
Normally you write a configuration to setup the database from scratch and another configuration to upgrade to higher versions. In upgrade-mode, the tool executes all upgrade scripts that are required.
- Migrate a database automatically to the current version by execution of .sql scripts or java code
- Check an existing database for compliance against .sql scripts
- Execute and parse SQL scripts, even those generated by eclipselink (with and without ; )
The AutoMigrationTool maintains a table db_version in the database in which it stored the database version.
- it reads the db_version table
- it scans in a preconfigured folder for migration scripts
- it executes all scripts, that are required to migrate the database from the current version to a target version (or the latest version possible)
- it update the db_version table
- script name contains a version information: up_version_additional_info.suffix
suffix can be:
- .sql
- .xml
- .groovy
version can be:
- a number or many numbers divided by _ or . or -
additional_info is an optional description for the script.
examples: up_1_0_0_initial.sql up_2.1.35.sql
The schema-check is an optional validation step. It can be invoked separately or as a (final) part of the database migration. The DatabaseSchemaChecker gets
- a JdbcDatabase with connection properties as input and
- a list of URLs to .sql scripts as input.
- it reads the database catalog and builds a CatalogDescription (1)
- it parses all sql-scripts and builds another CatalogDescription (2)
- it compares the actual catalog (1) with the expected catalog (2) and reports all differences found.
==> Thus you immediatly find any modifications in the database or inconsistencies in your schema-scripts.
- GettingStartedDbMigrate
- Example-Project: Look into the example to get an impression quickly or to use the example as a starting project for your own database.
- configuration and features: Look into the detailed documentation to learn the configuration and other features.
<dependency>
<groupId>de.viaboxx</groupId>
<artifactId>dbmigrate</artifactId>
<version>2.5.15</version>
</dependency>
- InvokerTool
- DDLParserTool
- DbUnitDumpTool
- DbUnitSetupTool
- HistoryGeneratorTool
- CatalogGeneratorTool
- ScriptTransformatorTool