Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Postgresql #35

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ jobs:
test:
env:
RAILS_ENV: "test"
TEST_DATABASE_URL: "mysql2://root:[email protected]:3306/unipept_test"
TEST_DATABASE_URL: "postgresql://unipept:[email protected]:5432/unipept_test"
runs-on: ubuntu-latest
services:
mysql:
image: mariadb:10.9
psql:
image: postgres:16.2
env:
MYSQL_DATABASE: "unipept_test"
MYSQL_ROOT_PASSWORD: "unipept"
MYSQL_HOST: "localhost"
POSTGRES_DB: "unipept_test"
POSTGRES_PASSWORD: "unipept"
POSTGRES_USER: "unipept"
ports:
- 3306:3306
options: --health-cmd "mysqladmin ping -h localhost" --health-interval 10s --health-timeout 5s --health-retries 5
- 5432:5432
options: --health-cmd "pg_isready" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- name: Use ruby from .ruby-version
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ ruby "3.1.2"
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.3", ">= 7.0.3.1"

# Use mysql as the database for Active Record
gem "mysql2", "~> 0.5", "> 0.5.5"
# Use Postgres as the database for Active Record
gem "pg", "~> 1.5.6"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ GEM
minitest (5.18.0)
msgpack (1.5.6)
multi_json (1.15.0)
mysql2 (0.5.6)
net-imap (0.2.3)
digest
net-protocol
Expand Down Expand Up @@ -150,6 +149,7 @@ GEM
parallel (1.22.1)
parser (3.1.2.1)
ast (~> 2.4.1)
pg (1.5.6)
public_suffix (5.0.0)
puma (5.6.5)
nio4r (~> 2.0)
Expand Down Expand Up @@ -253,9 +253,9 @@ DEPENDENCIES
debug
jbuilder
multi_json (~> 1.15.0)
mysql2 (~> 0.5, > 0.5.5)
octokit (~> 5.4)
oj (~> 3.13)
pg (~> 1.5.6)
puma (~> 5.0)
rails (~> 7.0.3, >= 7.0.3.1)
rails-controller-testing (~> 1.0)
Expand Down
8 changes: 4 additions & 4 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
default: &default
adapter: mysql2
username: root
adapter: postgresql
username: unipept
password: unipept
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

development:
<<: *default
username: unipept
database: unipept
# setup local port forwarding for this to work
host: 127.0.0.1
port: 3306
port: 5432
schema_search_path: "unipept"

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
Expand Down
108 changes: 61 additions & 47 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading