Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternatives to DDLUtils from apache

I would like to know which alternatives exist to replace DDL utils from Apache.

I ask this because ddlutils project seams to be Dead, and also it does not support H2 Databases. I've searched for it, and I found suggestions like liquidbase or flyway.

My problem is: These frameworks run when project starts and change DB structure based on some XML files. They are really designed for Database Migration.

What I want is a framework to CREATE/ALTER Tables in Runtime, in a high abstraction level., i.e. supportting at least Mysql, Sqlserver, oracle, and H2.

For example I could tell to the engine that I want to create a table with a Field AGE with Type Number, and the framework would rephrase to:

create table MY( id bigint(20))
create table MY(id bigint)
create table MY (id, number)

depending on the underlying db engine.

Any suggestions?

I could see there is a patch for ddlutils, for it to support H2. However I wasn't able to patch my svn checkout...

Any help will be appreciated.

thanks in advance rui

like image 932
user1680680 Avatar asked Oct 16 '14 18:10

user1680680


2 Answers

I know this is an old thread, but wanted to give a definitive answer.

Yes, DdlUtils is dead, hasn't seen an update in 2 years now.

However, it looks like the guys might have switched over to https://www.symmetricds.org. Their repo is https://github.com/JumpMind/symmetric-ds.

As soon as you scratch away at the surface, you'll find that the core of DdlUtils is still in there (even has some of the old Apache copyright notices).

Class names have changed, APIs have changed so there is not a 1-to-1 mapping, but it is getting regular updates and includes H2 and other database support. Honestly I'd rather be getting those things instead of keeping the old APIs.

You're not going to find a guide on using Symmetric DS in the same way as the old DdlUtils doco, but there is enough in the code that you should be able to piece it together.

like image 64
dnebing Avatar answered Nov 10 '22 21:11

dnebing


Take a look on jOOQ it is very useful in generating DDL (and DML too)

create.createTable("table")
      .column("column1", INTEGER)
      .column("column2", VARCHAR(10).nullable(false))
      .constraints(
          constraint("pk").primaryKey("column1"),
          constraint("uk").unique("column2"),
          constraint("fk").foreignKey("column2").references("some_other_table"),
          constraint("ck").check(field(name("column2")).like("A%"))
      )
      .execute();
like image 22
7er Avatar answered Nov 10 '22 21:11

7er