Commit aadee592 authored by Ash McKenzie's avatar Ash McKenzie

New scripts/db_migrate to handle DB migrations

parent 06bae34e
...@@ -342,9 +342,8 @@ rspec fast_spec_helper minimal: ...@@ -342,9 +342,8 @@ rspec fast_spec_helper minimal:
db:rollback: db:rollback:
extends: .db-job-base extends: .db-job-base
script: script:
- if [[ -d "ee/" ]]; then task="db:migrate:main"; else task="db:migrate"; fi - scripts/db_migrate VERSION=20181228175414
- bundle exec rake "${task}" VERSION=20181228175414 - scripts/db_migrate SKIP_SCHEMA_VERSION_CHECK=true
- bundle exec rake "${task}" SKIP_SCHEMA_VERSION_CHECK=true
db:migrate:reset: db:migrate:reset:
extends: .db-job-base extends: .db-job-base
...@@ -369,8 +368,7 @@ db:migrate-from-previous-major-version: ...@@ -369,8 +368,7 @@ db:migrate-from-previous-major-version:
- git checkout -f $CI_COMMIT_SHA - git checkout -f $CI_COMMIT_SHA
- SETUP_DB=false USE_BUNDLE_INSTALL=true bash scripts/prepare_build.sh - SETUP_DB=false USE_BUNDLE_INSTALL=true bash scripts/prepare_build.sh
script: script:
- if [[ -d "ee/" ]]; then task="db:migrate:main"; else task="db:migrate"; fi - run_timed_command "scripts/db_migrate"
- run_timed_command "bundle exec rake ${task}"
db:check-schema: db:check-schema:
extends: extends:
...@@ -379,8 +377,7 @@ db:check-schema: ...@@ -379,8 +377,7 @@ db:check-schema:
variables: variables:
TAG_TO_CHECKOUT: "v14.4.0" TAG_TO_CHECKOUT: "v14.4.0"
script: script:
- if [[ -d "ee/" ]]; then task="db:migrate:main"; else task="db:migrate"; fi - run_timed_command "scripts/db_migrate"
- run_timed_command "bundle exec rake ${task}"
- scripts/schema_changed.sh - scripts/schema_changed.sh
- scripts/validate_migration_timestamps - scripts/validate_migration_timestamps
......
#!/bin/bash
root_path="$(cd "$(dirname "$0")/.." || exit ; pwd -P)"
if [[ -d "${root_path}/ee/" ]]; then
task="db:migrate:main"
else
task="db:migrate"
fi
eval "bundle exec rake ${task} ${*}"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment