Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Liquibase - common columns?

Tags:

java

liquibase

In my db every table has 4 common columns - DATE_CREATED, USER_CREATED, DATE_MODIFIED, USER_MODIFIED, and I want to propagate this rule to all new tables implicitly.

Is it possible to do it without having to generate liquibase script manually?

like image 845
Askar Kalykov Avatar asked Oct 28 '25 10:10

Askar Kalykov


1 Answers

There is nothing built into Liquibase to support this.

Your easiest option would be to use XML document entities which is purely XML-level and therefore transparent to Liquibase. They would allow you to attach common XML into your changelog files.

A more complex approach would be to use the Liquibase extension system (http://liquibase.org/extensions) which allows you to redefine the logic to convert changeSets into SQL. That would allow you to inject any logic you want, including common data types, standard columns, or anything else.

like image 52
Nathan Voxland Avatar answered Oct 31 '25 00:10

Nathan Voxland