Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ability to run DB migrations programmatically #1315

Closed
ipolevoy opened this issue Mar 22, 2024 · 2 comments
Closed

Implement ability to run DB migrations programmatically #1315

ipolevoy opened this issue Mar 22, 2024 · 2 comments

Comments

@ipolevoy
Copy link
Member

In modern containerized systems, the presence of source code with migrations is not always guaranteed. This creates obstacles to running migrations in a separate step before deployment. It would be convenient to run migrations at will, for instance when an application starts.

@ipolevoy
Copy link
Member Author

ipolevoy commented Apr 2, 2024

Some of the work has been done outside the framework in: #209 by @stefanhendriks
but there is a pressure to do this now that many projects moved on to Kubernetes and eliminating the migration step is preferred.

@ipolevoy
Copy link
Member Author

ipolevoy commented Apr 2, 2024

Basically, the idea is to keep the migrations files (SQL and Groovy) in the path of the app as resources. When an ll starts up, just execute the DB migration logic. This way, even if you have multiple nodes in the environment, the first node with non-executed migrations will execute the migration logic, and any following nodes will attempt to do the same, but will also detect that all migrations are up to date.
This approach eliminates the necessity to run the migrator my hand somewhere or in Jenkins. Simply deploy the new version of the app, and the first node with new migrations will execute them at the start.

ipolevoy added a commit that referenced this issue Apr 8, 2024
 - separated the DB migrator from the maven plugin
ipolevoy added a commit that referenced this issue Apr 16, 2024
 - separated the DB migrator from the maven plugin
ipolevoy added a commit that referenced this issue Apr 19, 2024
 - separated the DB migrator from the maven plugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant