1

I am currently trying to switch from SQlite3 to Postgres, and was wondering how I can change my database name? According to Heroku, they say this:

Note the adapter name is postgresql not postgres or pg. You will also need to change the database: to a custom name. A final version might look something like this:

development:
  adapter: postgresql
  database: my_database_development
  pool: 5
  timeout: 5000
test:
  adapter: postgresql
  database: my_database_test
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  database: my_database_production
  pool: 5
  timeout: 5000

I see right now that I have the following for my database name for test environment:

test:
  <<: *default
  database: db/test.sqlite3

For this (and dev and production environments) do I need to simply change the name of the database, or do I need to do something more than this. Because for the SQLite3 files, it has a .sqlite3 extension. Does postgres have a similar situation?

1 Answer 1

1

Yes, you can just change the database name for each additional environment. The

<<: *default

means that is the part of the configuration that will be used in the other environments, so you don't have to duplicate your code (DRY).

For postgres you don't have to give extensions (as I remember). Just give the databases clear names, and that should work.

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

1 Comment

Perfect! Worked great. There is no reason to set database names in ENV variables, is there?

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.