1

I'm working on a spring boot application that uses Camunda

I've just bumped our Camunda version by a couple of minor versions, and I'm running incremental SQL scripts with Flyway to update the DB to support the new camunda version (v1.02--7.8-7.9.sql and v1.03--7.9>7.10.sql)

This migration works fine on existing databases that are currently on Camunda 7.8, but it fails when I try to run the application on a clean database.

One of the scripts tries to add a column:

ALTER TABLE ACT_ID_USER
  ADD LOCK_EXP_TIME_ timestamp;

But, if the application is running on a clean database, it will complain that the column is already present - presumably because the database has just been initialised with 9.10, so running a 9.8 migration after the fact doesn't work

I'm wondering if there's a way for Flyway to not run those migrations, if the database is empty on startup?

Or, is my problem the way I'm using Flyway? Should flyway be getting executed before Camunda initialises the Database?

C A Mc
  • 449
  • 1
  • 4
  • 7
  • You can be check if the column already exists, for instance on postgresql https://stackoverflow.com/questions/12597465/how-to-add-column-if-not-exists-on-postgresql and on MySQL: https://stackoverflow.com/questions/24571611/mysql-alter-table-if-column-not-exists – vladwoguer May 27 '19 at 02:30
  • 2
    I was hoping to avoid touching the SQL scripts, since theyve been provided by Camunda... but yeah, its looking like adding 'if not exists' to each command might be my easiest solution – C A Mc May 27 '19 at 03:13
  • To your last question: you should either use flyway or camunda initiliazation, not both – Jan Galinski May 27 '19 at 12:58

0 Answers0