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?
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.