Axelor flyway based db version / migrations

Siddique Ahmad
2 min readSep 29, 2022

--

Every software needs to be version controlled, and Axelor open platform based open source ERP has no exception. Axelor, the French company behind this, maintains the code version at GitHub, but what about db changes, we will explore today.

Axelor use Flyway as DB version controller

AOP ( Axelor open platform) has one gradle task for database migrations. we need to

1. Create one table, sql shared below.

CREATE TABLE schema_version ( installed_rank int4 NOT NULL, "version" varchar(50) NULL, description varchar(200) NOT NULL, "type" varchar(20) NOT NULL, script varchar(1000) NOT NULL, checksum int4 NULL, installed_by varchar(100) NOT NULL, installed_on timestamp NOT NULL DEFAULT now(), execution_time int4 NOT NULL, success bool NOT NULL, CONSTRAINT schema_version_pk PRIMARY KEY (installed_rank) ); CREATE INDEX schema_version_s_idx ON schema_version USING btree (success);

2. Files setup as the following

3. Run command, assuming the correct db credentials in config / application properties file.

./gradlew database --migrate

if all went fine you will see messages

Start db migration…
db migration complete.

In next write up we will learn, what it meant by R__ and V1__ in filename.

--

--

Siddique Ahmad

Passionate about devops, data analytics, business solutions, #kubernets @debezium flink-statefun, kogito