Hacker News new | ask | show | jobs
by gifflar 1437 days ago
We store our database functions in SQL scripts that are automatically executed with every Flyway migration, so-called callback scripts.

In the callback script every function is declared to be created or recreated. As Flyway is executed with each application start, the database functions are recreated with every application start, even if they didn’t change.

This approach has its pros and cons but it ensures that database functions always match the version of the application code.

Because the callback script of a database function is stored in a file that is edited when needed, the Git history works the same as for application code.