diff --git a/internal/db/sqltest/Makefile b/internal/db/sqltest/Makefile index 5305a6bb4e..04731bb218 100644 --- a/internal/db/sqltest/Makefile +++ b/internal/db/sqltest/Makefile @@ -33,7 +33,7 @@ test: -e POSTGRES_PASSWORD=boundary \ -e POSTGRES_USER=boundary \ -e POSTGRES_DB=boundary \ - -v "$(CWD)/../schema/migrations/postgres":/migrations \ + -v "$(CWD)/../schema/migrations":/migrations \ -v "$(CWD)/initdb.d":/docker-entrypoint-initdb.d/ \ $(POSTGRES_DOCKER_IMAGE) @docker run -it --rm \ @@ -56,7 +56,7 @@ database-up: -e POSTGRES_PASSWORD=boundary \ -e POSTGRES_USER=boundary \ -e POSTGRES_DB=boundary \ - -v "$(CWD)/../schema/migrations/postgres":/migrations \ + -v "$(CWD)/../schema/migrations":/migrations \ -v "$(CWD)/initdb.d":/docker-entrypoint-initdb.d/ \ $(POSTGRES_DOCKER_IMAGE) diff --git a/internal/db/sqltest/initdb.d/00_schema.sh b/internal/db/sqltest/initdb.d/00_schema.sh index b1cc3fdb7a..a2ce2aa0ba 100755 --- a/internal/db/sqltest/initdb.d/00_schema.sh +++ b/internal/db/sqltest/initdb.d/00_schema.sh @@ -26,8 +26,31 @@ docker_process_sql() { PGHOST= PGHOSTADDR= "${query_runner[@]}" "$@" } -# Run migrations in order. -for file in $(ls -v /migrations/**/*.sql); do - echo running "$file" - docker_process_sql -f "$file" -done +if [ -d /migrations/base ]; then + # Run migrations in order. + for file in $(ls -v /migrations/base/postgres/**/*.up.sql); do + echo running "$file" + docker_process_sql -f "$file" + done + + if [ -d /migrations/oss ]; then + # Run migrations in order. + for file in $(ls -v /migrations/oss/postgres/**/*.up.sql); do + echo running "$file" + docker_process_sql -f "$file" + done + fi + + for d in $(find /migrations/ -mindepth 1 -maxdepth 1 -type d -not -name 'oss' -not -name 'base'); do + for file in $(ls -v ${d}/postgres/**/*.up.sql); do + echo running "$file" + docker_process_sql -f "$file" + done + done +else + # Run migrations in order. + for file in $(ls -v /migrations/**/*.up.sql); do + echo running "$file" + docker_process_sql -f "$file" + done +fi