diff --git a/Gemfile b/Gemfile index 4c63eb3..fa49bd2 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,8 @@ ruby '2.4.1' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.2.3' # Use sqlite3 as the database for Active Record -gem 'sqlite3' +#gem 'sqlite3' +gem 'pg' # Use Puma as the app server gem 'puma', '~> 3.11' # Use SCSS for stylesheets diff --git a/Gemfile.lock b/Gemfile.lock index 4305a5f..9889a5f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -99,6 +99,7 @@ GEM nio4r (2.4.0) nokogiri (1.10.4) mini_portile2 (~> 2.4.0) + pg (1.1.4) public_suffix (3.1.1) puma (3.12.1) rack (2.0.7) @@ -162,7 +163,6 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.4.1) thor (0.20.3) thread_safe (0.3.6) tilt (2.0.9) @@ -192,13 +192,13 @@ DEPENDENCIES commonmarker (~> 0.20) jbuilder (~> 2.5) listen (>= 3.0.5, < 3.2) + pg puma (~> 3.11) rails (~> 5.2.3) sass-rails (~> 5.0) selenium-webdriver spring spring-watcher-listen (~> 2.0.0) - sqlite3 tzinfo-data uglifier (>= 1.3.0) web-console (>= 3.3.0) diff --git a/config/database.yml b/config/database.yml index 0d02f24..7fa20fc 100644 --- a/config/database.yml +++ b/config/database.yml @@ -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 + adapter: postgresql pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 + encoding: unicode development: <<: *default - database: db/development.sqlite3 + database: rails_development_db # 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: rails_test_db production: <<: *default - database: db/production.sqlite3 + database: tails_production_db diff --git a/config/sqlite.database.yml b/config/sqlite.database.yml new file mode 100644 index 0000000..0d02f24 --- /dev/null +++ b/config/sqlite.database.yml @@ -0,0 +1,25 @@ +# SQLite version 3.x +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem 'sqlite3' +# +default: &default + adapter: sqlite3 + pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + timeout: 5000 + +development: + <<: *default + database: db/development.sqlite3 + +# 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 + +production: + <<: *default + database: db/production.sqlite3 diff --git a/db/schema.rb b/db/schema.rb index c514005..415eb33 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,11 +12,14 @@ ActiveRecord::Schema.define(version: 2019_08_25_224052) do + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + create_table "active_storage_attachments", force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false - t.integer "record_id", null: false - t.integer "blob_id", null: false + t.bigint "record_id", null: false + t.bigint "blob_id", null: false t.datetime "created_at", null: false t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true @@ -54,4 +57,5 @@ t.datetime "updated_at", null: false end + add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" end