Skip to content

Commit

Permalink
Merge pull request #3398 from hennevogel/drop/multi-db-support
Browse files Browse the repository at this point in the history
Drop multi db support
  • Loading branch information
hennevogel authored Jun 6, 2024
2 parents f902858 + b2f0796 commit f63adf7
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 47 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.bundle/cache
.git/
coverage/
db/*.sqlite3
Dockerfile
docker-compose.*
log/
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/next-rails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
name: next-rails
env:
OSEM_DB_ADAPTER: sqlite3
OSEM_DB_HOST: localhost
RAILS_ENV: test
strategy:
matrix:
Expand All @@ -30,7 +30,6 @@ jobs:
bundler-cache: true
- name: Prepare spec
run: |
rm -f osem_test osem_development
bundle exec rake db:setup --trace
bundle exec bin/rails webdrivers:chromedriver:update
- name: spec/${{ matrix.suite }}
Expand All @@ -41,3 +40,15 @@ jobs:
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage/coverage.xml
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_PASSWORD: mysecretpassword
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
15 changes: 13 additions & 2 deletions .github/workflows/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
name: spec
env:
OSEM_DB_ADAPTER: sqlite3
OSEM_DB_HOST: localhost
RAILS_ENV: test
strategy:
matrix:
Expand All @@ -38,7 +38,6 @@ jobs:
bundler-cache: true
- name: Prepare spec
run: |
rm -f osem_test osem_development
bundle exec rake db:setup --trace
bundle exec bin/rails webdrivers:chromedriver:update
bundle exec rake factory_bot:lint RAILS_ENV=test
Expand All @@ -50,3 +49,15 @@ jobs:
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage/coverage.xml
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_PASSWORD: mysecretpassword
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/db/test.sqlite3-journal
config/application.rb
config/config.yml
config/secrets.yml
Expand All @@ -18,7 +17,6 @@ capybara-*.html
/vendor/bundle
/log/*
/tmp/*
/db/*.sqlite3
/public/system/*
/coverage/
/spec/tmp/*
Expand Down
9 changes: 8 additions & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-06-06 14:55:31 UTC using RuboCop version 1.63.5.
# on 2024-06-06 15:22:39 UTC using RuboCop version 1.63.5.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -1156,6 +1156,13 @@ Rails/Blank:
- 'app/models/user.rb'
- 'spec/factories/event_schedule.rb'

# Offense count: 68
# Configuration parameters: Database, Include.
# SupportedDatabases: mysql, postgresql
# Include: db/**/*.rb
Rails/BulkChangeTable:
Enabled: false

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Rails/CompactBlank:
Expand Down
5 changes: 1 addition & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ gem 'puma'
# http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#responders
gem 'responders', '~> 3.0'

# as supported databases
gem 'mysql2'
# as database
gem 'pg'

# for tracking data changes
Expand Down Expand Up @@ -248,8 +247,6 @@ end
group :development, :test do
# as debugger
gem 'byebug'
# as development/test database
gem 'sqlite3'
# to test new rails version
gem 'next_rails'
end
5 changes: 0 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ GEM
multi_xml (0.7.1)
bigdecimal (~> 3.1)
multipart-post (2.4.1)
mysql2 (0.5.6)
net-http (0.4.1)
uri
net-imap (0.4.11)
Expand Down Expand Up @@ -556,8 +555,6 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.7.3)
mini_portile2 (~> 2.8.0)
ssrf_filter (1.1.2)
stripe (5.55.0)
stripe-ruby-mock (3.1.0)
Expand Down Expand Up @@ -665,7 +662,6 @@ DEPENDENCIES
mina
mini_magick
money-rails
mysql2
next_rails
omniauth
omniauth-facebook
Expand Down Expand Up @@ -703,7 +699,6 @@ DEPENDENCIES
simplecov-cobertura
skylight
sprockets-rails
sqlite3
stripe
stripe-ruby-mock (~> 3.1.0.rc3)
timecop
Expand Down
15 changes: 2 additions & 13 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
<%
encoding = 'unicode'
if ENV.fetch('OSEM_DB_ADAPTER', nil) == 'mysql2'
encoding = 'utf8'
end
%>


default: &default
adapter: <%= ENV.fetch('OSEM_DB_ADAPTER', 'postgresql') %>
encoding: <%= encoding %>
adapter: 'postgresql'
encoding: 'unicode'
host: <%= ENV.fetch('OSEM_DB_HOST', 'database') %>
port: <%= ENV.fetch('OSEM_DB_PORT', '5432') %>
username: <%= ENV.fetch('OSEM_DB_USER', 'postgres') %>
Expand All @@ -21,9 +13,6 @@ development:
<<: *default
database: osem_development

# Warning: The database defined as "test" will be erased and
# re-generated when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: osem_test
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "2.4"

services:
database:
image: postgres:12-alpine
image: postgres:16-alpine
environment:
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_PASSWORD: mysecretpassword
Expand Down
3 changes: 0 additions & 3 deletions dotenv.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
# bundle exec rake secret
# SECRET_KEY_BASE=12345

# The type of database to use (postgresql, mysql2, sqlite3)
# OSEM_DB_ADAPTER=mysql2

# The name of the host the database runs on
# OSEM_DB_HOST=database

Expand Down
13 changes: 0 additions & 13 deletions lib/tasks/dump_db.rake

This file was deleted.

0 comments on commit f63adf7

Please sign in to comment.