From 6e3a10a3b4d70ec00e985f7cb5db8cc79664f509 Mon Sep 17 00:00:00 2001 From: Lior Keren Date: Tue, 13 Dec 2022 10:49:31 +0200 Subject: [PATCH] Migrate Database From Sqlite to PostgreSQL Wanted to be aligned with Foreman --- Gemfile | 4 ++-- config/database.yml | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index b323952..e6c7c3b 100644 --- a/Gemfile +++ b/Gemfile @@ -7,8 +7,8 @@ ruby '~> 2.7.0' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails', branch: 'main' gem 'rails', '~> 6.1.6', '>= 6.1.6.1' -# Use sqlite3 as the database for Active Record -gem 'sqlite3', '~> 1.4' +# Use PostgreSQL as the database for Active Record +gem 'pg' # Use Puma as the app server gem 'puma', '~> 5.0' # Use SCSS for stylesheets diff --git a/config/database.yml b/config/database.yml index 4a8a1b2..8b158fc 100644 --- a/config/database.yml +++ b/config/database.yml @@ -10,15 +10,24 @@ default: &default timeout: 5000 development: - <<: *default - database: db/development.sqlite3 +adapter: postgresql +host: localhost +username: postgres +password: password +pool: 5 +database: todo_list_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: db/test.sqlite3 + adapter: postgresql + host: localhost + username: postgres + password: password + pool: 5 + database: todo_list_test production: <<: *default