Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java library to maintain database structure

My application is always developing, so occasionally - when the version upgrades - some tables need to be created/altered/deleted, some data modified, etc. Generally some sql code needs to be executed.

Is there a Java library that can be used to keep my database structure up to date (by analyzing something like "db structure version" information and executing custom sql to code to update from one version to another)?

Also it would be great to have some basic actions (like add/remove column) ready to use with minimal configuration, ie name/type and no sql code.

like image 582
shutyaev Avatar asked May 31 '11 14:05

shutyaev


2 Answers

Try DBDeploy. Although I haven't used it in the past, it sounds like this project would help in your case. DBDeploy is a database refactoring manager that:

"Automates the process of establishing which database refactorings need to be run against a specific database in order to migrate it to a particular build."

It is known to integrate with both Ant and Maven.

like image 159
Vineet Reynolds Avatar answered Sep 23 '22 16:09

Vineet Reynolds


Try Liquibase.

Liquibase is an open source (Apache 2.0 Licensed), database-independent library for tracking, managing and applying database changes. It is built on a simple premise: All database changes are stored in a human readable yet trackable form and checked into source control.

Supported features:

  • Extensibility
  • Merging changes from multiple developers
  • Code branches
  • Multiple Databases
  • Managing production data as well as various test datasets
  • Cluster-safe database upgrades
  • Automated updates or generation of SQL scripts that can be approved and applied by a DBA
  • Update rollbacks
  • Database ”diff“s
  • Generating starting change logs from existing databases
  • Generating database change documentation
like image 22
Tomasz Błachowicz Avatar answered Sep 19 '22 16:09

Tomasz Błachowicz