0

I want to use sqlite3 but pg for production on heroku. However, I don't have postgres installed on local host, so bundle install doesn't work when I run the code below

I know there's something I can add to the code below so that rails doesn't try to install it when I run bundle install but i don't know what that is. Can anyone tell me?

#gem 'sqlite3'
group :development, :test do
  gem 'sqlite3'
end
group :production do
  gem 'pg'
end
0

1 Answer 1

2

By default, bundler installs all defined groups. You have to tell it explicitly which groups you do not want. In this case it would probably be

bundle install --without production

Bundler will remember your choice of groups in .bundle/config. Consequently you should not check the contents of that directory into source control.

However you should note that there are various differences in the SQL dialect of SQLite and Postgres. So unless you do only trivial stuff, you should definitely test on Postgres too. Things like handling of dates, numerics and various string types differences with Postgres generally being much stricter. SQLite maps most of the datatypes to strings of infinite length. Postgres uses fixed data types which are enforced.

Sign up to request clarification or add additional context in comments.

1 Comment

why --without development test... I thought it would be --without production since pg is the production database?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.