Flyway migrations needing superuser privilege

1.5k views Asked by At

I have some flyway migrations that need DB superuser privilege to get executed. I want to avoid running the flyway migrations as a superuser and run the app say a different less privileged user (I can not run the app as a superuser).

Is there any good way to achieve this with flyway, i.e. have different migrations run as different users?

1

There are 1 answers

0
Axel Fontaine On

You could have two Flyway migrations runs (regular & superuser), however this could then set you up for trouble as you would have to be very careful with their interdependencies.

The best solution is the one you already mentioned: configure Flyway with a user that has the necessary privileges. Simple and easy.