Skip to content

Commit

Permalink
Separate the setup of MySQL, PostgreSQL, and SQLite3 into individual …
Browse files Browse the repository at this point in the history
…scripts
  • Loading branch information
hidakatsuya committed Jul 11, 2024
1 parent 86ecd00 commit ef9212a
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
25 changes: 25 additions & 0 deletions scripts/setup-mysql.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -eu

sudo apt-get install -y --no-install-recommends default-mysql-client

docker run \
--name redmine-mysql \
-e MYSQL_ROOT_PASSWORD=password \
-e MYSQL_DATABASE=redmine_test \
-p 3306:3306 \
-d $DATABASE \
--character-set-server=utf8mb4 \
--collation-server=utf8mb4_unicode_ci

cat <<EOS > config/database.yml
test:
adapter: mysql2
database: redmine_test
host: 127.0.0.1
port: 3306
username: root
password: password
encoding: utf8mb4
EOS
22 changes: 22 additions & 0 deletions scripts/setup-postgresql.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -eu

sudo apt-get install -y --no-install-recommends libpq-dev

docker run \
--name redmine-postgres \
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
-d $DATABASE

cat <<EOS > config/database.yml
test:
adapter: postgresql
database: redmine_test
encoding: utf8
host: localhost
port: 5432
username: postgres
password: postgres
EOS
11 changes: 11 additions & 0 deletions scripts/setup-sqlite3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -eu

sudo apt-get install -y --no-install-recommends libsqlite3-dev

cat <<EOS > config/database.yml
test:
adapter: sqlite3
database: db/test.sqlite3
EOS

0 comments on commit ef9212a

Please sign in to comment.