Create new script to apply Gatheouse DB Schema migrations. #108
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this change?
Adds a new
./db
folder which contains DB schema migrations for the Gatehouse DB and scripts to apply themThe
./migrate.sh
script does the following:6543
.flyway
in Docker to list pending migrations.flyway
in Docker to apply pending migrations.Why Flyway?
When looking for a DB schema managed I wanted 2 things:
Flyway seemed to pop up a lot when searching from DB migrator tools and seems quite popular on Github with 20k stars. It has a CLI w/official Docker image which is what this PR is using and it has a programatic API (Java unfortunately, but would work for a Scala lambda)
A runner up I considered was Knex.js which also has a CLI and Programatic API, unfortunately there was no official docker image I could see and it came with a lot of extra functionality that I wanted to avoid for now such as an ORM for JS/Typescript.
How to test
Tested with
./migrate.sh CODE
(overrode main branch check)