From 1f52213c35777c6432937e1c7b9ba622ace53b65 Mon Sep 17 00:00:00 2001 From: Trevor Vallender Date: Sat, 13 Apr 2024 14:13:37 +0100 Subject: [PATCH] Switch to Postgres --- Gemfile | 40 +--------------------------------------- Gemfile.lock | 9 ++------- config/database.yml | 21 ++++++++------------- 3 files changed, 11 insertions(+), 59 deletions(-) diff --git a/Gemfile b/Gemfile index 5bd2e3e..a1f4a87 100644 --- a/Gemfile +++ b/Gemfile @@ -2,66 +2,28 @@ source "https://rubygems.org" ruby "3.3.0" -# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem "rails", "~> 7.1.3", ">= 7.1.3.2" - -# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] gem "sprockets-rails" - -# Use sqlite3 as the database for Active Record -gem "sqlite3", "~> 1.4" - -# Use the Puma web server [https://github.com/puma/puma] +gem "pg" gem "puma", ">= 5.0" - -# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] gem "importmap-rails" - -# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] gem "turbo-rails" - -# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] gem "stimulus-rails" - -# Build JSON APIs with ease [https://github.com/rails/jbuilder] gem "jbuilder" - -# Use Redis adapter to run Action Cable in production -# gem "redis", ">= 4.0.1" - -# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] -# gem "kredis" - -# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] # gem "bcrypt", "~> 3.1.7" - -# Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem "tzinfo-data", platforms: %i[ windows jruby ] - -# Reduces boot times through caching; required in config/boot.rb gem "bootsnap", require: false - -# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] # gem "image_processing", "~> 1.2" group :development, :test do - # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem gem "debug", platforms: %i[ mri windows ] end group :development do - # Use console on exceptions pages [https://github.com/rails/web-console] gem "web-console" - - # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler] - # gem "rack-mini-profiler" - - # Speed up commands on slow machines / big apps [https://github.com/rails/spring] - # gem "spring" end group :test do - # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing] gem "capybara" gem "selenium-webdriver" end diff --git a/Gemfile.lock b/Gemfile.lock index 7491496..ceca887 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -152,6 +152,7 @@ GEM racc (~> 1.4) nokogiri (1.16.4-x86_64-linux) racc (~> 1.4) + pg (1.5.6) psych (5.1.2) stringio public_suffix (5.0.5) @@ -215,12 +216,6 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.7.3-aarch64-linux) - sqlite3 (1.7.3-arm-linux) - sqlite3 (1.7.3-arm64-darwin) - sqlite3 (1.7.3-x86-linux) - sqlite3 (1.7.3-x86_64-darwin) - sqlite3 (1.7.3-x86_64-linux) stimulus-rails (1.3.3) railties (>= 6.0.0) stringio (3.1.0) @@ -260,11 +255,11 @@ DEPENDENCIES debug importmap-rails jbuilder + pg puma (>= 5.0) rails (~> 7.1.3, >= 7.1.3.2) selenium-webdriver sprockets-rails - sqlite3 (~> 1.4) stimulus-rails turbo-rails tzinfo-data diff --git a/config/database.yml b/config/database.yml index 796466b..f8f5043 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,25 +1,20 @@ -# SQLite. Versions 3.8.0 and up are supported. -# gem install sqlite3 -# -# Ensure the SQLite 3 gem is defined in your Gemfile -# gem "sqlite3" -# default: &default - adapter: sqlite3 + adapter: postgresql + encoding: unicode pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 + host: localhost + username: <%= ENV.fetch("POSTGRES_USER") { "postgres" } %> + password: <%= ENV.fetch("POSTGRES_PASSWORD") { "postgres" } %> development: <<: *default - database: storage/development.sqlite3 + database: forg_development -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. test: <<: *default - database: storage/test.sqlite3 + database: forg_test production: <<: *default - database: storage/production.sqlite3 + database: forg_production