ruby-on-railspostgresqlsqlitesqlite3-ruby

Why postgres is not used in development?


I have encountered this in my Gemfile while learning ruby on rails:

group :development, :test do
  gem 'sqlite3', '~> 1.4'

group :production do
  gem 'pg'

So far I have understood that sqlite3 is not a production-ready database as it does not support multiple users to write the database at the same time. In this case, why don't we just use postgres in development?


Solution

  • There is no reason you can’t. It just requires additional configuration. It’s actually best practice to use the same database in development and production. SQLite is included for ease of use, and would probably fine for a lot of applications. But SQLite cannot be used on Heroku and some other hosting platforms. So you are better off setting up Postgres on your local machine for development in my opinion.