Skip to content

Commit

Permalink
Removing database.yml
Browse files Browse the repository at this point in the history
Now using pg on every env
  • Loading branch information
erickm32 committed May 14, 2020
1 parent d6a569e commit b0450b6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
/db/*.sqlite3
/db/*.sqlite3-journal

config/database.yml

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
Expand Down
6 changes: 1 addition & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ruby '2.6.3'
gem 'rails', '~> 6.0.3'
# Use sqlite3 as the database for Active Record
# Use Puma as the app server
gem 'pg', '~> 1.2'
gem 'puma', '~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
Expand Down Expand Up @@ -37,7 +38,6 @@ gem 'rails-controller-testing'
gem 'bootsnap', '>= 1.4.2', require: false

group :development, :test do
gem 'sqlite3', '~> 1.4'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: %i[mri mingw x64_mingw]
end
Expand All @@ -59,9 +59,5 @@ group :test do
gem 'webdrivers'
end

group :production do
gem 'pg'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ DEPENDENCIES
jbuilder (~> 2.7)
jquery-rails
listen (>= 3.0.5, < 3.2)
pg
pg (~> 1.2)
puma (~> 4.1)
rails (~> 6.0.3)
rails-controller-testing
Expand Down
19 changes: 7 additions & 12 deletions config/database.yml → config/sample.database.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
adapter: postgresql
encoding: unicode
host: <%= ENV['DATABASE_HOST'] || 'localhost' %>
port: <%= ENV['DATABASE_PORT'] || 5432 %>

development:
<<: *default
database: db/development.sqlite3
database: alpha_blog_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
database: alpha_blog_test

production:
<<: *default
database: db/production.sqlite3
database: alpha_blog_production
3 changes: 3 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

ActiveRecord::Schema.define(version: 2020_05_14_200519) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "article_categories", force: :cascade do |t|
t.integer "article_id"
t.integer "category_id"
Expand Down

0 comments on commit b0450b6

Please sign in to comment.