Skip to content

Commit

Permalink
revert slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
timdiggins committed Nov 9, 2024
1 parent 7f810e7 commit 9b71229
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ jobs:
env:
BUNDLE_GEMFILE: "rails_${{ matrix.rails }}.gemfile"
DB_HOST: 127.0.0.1
MYSQL_ROOT_PASSWORD: active_record_union
steps:
- uses: actions/checkout@v4

Expand All @@ -69,5 +68,4 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # install gems and cache

- run: bin/create-db-users
- run: bundle exec rspec --force-color --format d
8 changes: 3 additions & 5 deletions bin/create-db-users
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@ HELP

USER='active_record_union'
PASS='active_record_union'
DB_HOST=${DB_HOST:-localhost}

set -e
log() { if [ -t 1 ]; then echo -e >&2 "${GREEN}create-db-users: $@${RESET_COLOR}"; else echo >&2 "$@"; fi }

create_mysql_user() {
if [ -n "$MYSQL_ROOT_PASSWORD" ]; then PASS_ARG="--password=$MYSQL_ROOT_PASSWORD"; else PASS_ARG="-p"; fi
if mysql -s -u"$USER" -p"$PASS" -e '' 2>/dev/null; then return; fi
log "Creating MySQL '$USER' user. MySQL root password required."
mysql --verbose -uroot $PASS_ARG <<SQL
CREATE USER '$USER'@'$DB_HOST' IDENTIFIED BY '$PASS';
GRANT ALL PRIVILEGES ON \`test_active_record_union\`.* TO '$USER'@'$DB_HOST';
mysql --verbose -uroot -p <<SQL
CREATE USER '$USER'@'localhost' IDENTIFIED BY '$PASS';
GRANT ALL PRIVILEGES ON \`test_active_record_union\`.* TO '$USER'@'localhost';
SQL
}

Expand Down

0 comments on commit 9b71229

Please sign in to comment.