Skip to content

Commit

Permalink
feat: 🎸 データベースを PostgreSQL に変更した (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikukyugamer authored Nov 26, 2022
1 parent f37e4c4 commit b2bbeca
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 160 deletions.
15 changes: 15 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# PostgreSQL
PG_HOST_DEVELOPMENT=
PG_PORT_DEVELOPMENT=
PG_USERNAME_DEVELOPMENT=
PG_PASSWORD_DEVELOPMENT=

PG_HOST_PRODUCTION=
PG_PORT_PRODUCTION=
PG_USERNAME_PRODUCTION=
PG_PASSWORD_PRODUCTION=

PG_HOST_TEST=
PG_PORT_TEST=
PG_USERNAME_TEST=
PG_PASSWORD_TEST=
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ gem 'jbuilder'
gem 'jp_prefecture'
gem 'kaminari'
gem 'money-rails'
gem 'mysql2'
gem 'paranoia'
gem 'pg'
gem 'puma'
gem 'rails'
gem 'ransack'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ GEM
msgpack (1.5.1)
multi_json (1.15.0)
multipart-post (2.1.1)
mysql2 (0.5.3)
naught (1.1.0)
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
Expand All @@ -366,6 +365,7 @@ GEM
activerecord (>= 5.1, < 7.1)
parser (3.1.1.0)
ast (~> 2.4.1)
pg (1.4.5)
polyglot (0.3.5)
power_assert (1.1.7)
proc_to_ast (0.1.0)
Expand Down Expand Up @@ -681,8 +681,8 @@ DEPENDENCIES
kaminari
listen
money-rails
mysql2
paranoia
pg
pry
pry-byebug
pry-doc
Expand Down
2 changes: 1 addition & 1 deletion config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
WwY08qU12mLgKVnvDOI1WNO3VVdBRrLx7W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j6xWV8lu2L3lL79c3rCag0OD4Jgy4ng7hfi5Rzw8YmA3bv4kRk+ewA==--uSFcJynE+E8fxS2H--RrCqLyjIRyAMzo27yqaiGA==
52 changes: 29 additions & 23 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
default: &default
adapter: mysql2
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
encoding: utf8mb4
strict: false

test:
<<: *default
host: <%= ENV['MYSQL_HOST_TEST'] || Rails.application.credentials.mysql[:test][:host] %>
port: <%= ENV['MYSQL_PORT_TEST'] || Rails.application.credentials.mysql[:test][:port] %>
username: <%= ENV['MYSQL_USERNAME_TEST'] || Rails.application.credentials.mysql[:test][:username] %>
password: <%= ENV['MYSQL_PASSWORD_TEST'] || Rails.application.credentials.mysql[:test][:password] %>
database: <%= ENV['MYSQL_DATABASE_TEST'] || Rails.application.credentials.mysql[:test][:database] %>
adapter: postgresql
encoding: unicode
pool: <%= ENV['RAILS_MAX_THREADS'] || 5 %>

development:
<<: *default
host: <%= ENV['MYSQL_HOST_DEVELOPMENT'] || Rails.application.credentials.mysql[:development][:host] %>
port: <%= ENV['MYSQL_PORT_DEVELOPMENT'] || Rails.application.credentials.mysql[:development][:port] %>
username: <%= ENV['MYSQL_USERNAME_DEVELOPMENT'] || Rails.application.credentials.mysql[:development][:username] %>
password: <%= ENV['MYSQL_PASSWORD_DEVELOPMENT'] || Rails.application.credentials.mysql[:development][:password] %>
database: <%= ENV['MYSQL_DATABASE_DEVELOPMENT'] || Rails.application.credentials.mysql[:development][:database] %>
host: <%= ENV['PG_HOST_DEVELOPMENT'] || 'localhost' %>
port: <%= ENV['PG_PORT_DEVELOPMENT'] || 5432 %>
username: <%= ENV['PG_USERNAME_DEVELOPMENT'] || 'root' %>
password: <%= ENV['PG_PASSWORD_DEVELOPMENT'] || 'password' %>
database: gss2018_development
template: template0
collation: ja_JP.UTF-8
ctype: ja_JP.UTF-8
sslmode: disable

production:
<<: *default
host: <%= ENV['MYSQL_HOST_PRODUCTION'] || Rails.application.credentials.mysql[:production][:host] %>
port: <%= ENV['MYSQL_PORT_PRODUCTION'] || Rails.application.credentials.mysql[:production][:port] %>
username: <%= ENV['MYSQL_USERNAME_PRODUCTION'] || Rails.application.credentials.mysql[:production][:username] %>
password: <%= ENV['MYSQL_PASSWORD_PRODUCTION'] || Rails.application.credentials.mysql[:production][:password] %>
database: <%= ENV['MYSQL_DATABASE_PRODUCTION'] || Rails.application.credentials.mysql[:production][:database] %>
host: <%= ENV['PG_HOST_PRODUCTION'] || 'localhost' %>
port: <%= ENV['PG_PORT_PRODUCTION'] || 5432 %>
username: <%= ENV['PG_USERNAME_PRODUCTION'] || 'root' %>
password: <%= ENV['PG_PASSWORD_PRODUCTION'] || 'password' %>
database: gss2018_production
template: template0
collation: ja_JP.UTF-8
ctype: ja_JP.UTF-8

test:
<<: *default
host: <%= ENV['PG_HOST_TEST'] || 'localhost' %>
port: <%= ENV['PG_PORT_TEST'] || 5432 %>
username: <%= ENV['PG_USERNAME_TEST'] || 'gss2017' %>
password: <%= ENV['PG_PASSWORD_TEST'] || 'gss2017_password' %>
database: gss2018_test
sslmode: disable
Loading

0 comments on commit b2bbeca

Please sign in to comment.