I know there are numerous topics on this. I have tried them all to no success. Note, I do not need to maintain my previous data. I just need my app to work in Heroku.
Following this guide, this is one thing I've tried Change from SQLite to PostgreSQL in a fresh Rails project
So I have my application that works using sqlite3.
Go into 'gemfile' and change
gem 'sqlite3'
into gem 'pg'
run $ bundle
in terminal (to change Gemfile.lock)
Go to my database.yml
file and replace it with
development:
adapter: postgresql
encoding: utf8
database: project_development
pool: 5
username:
password:
test: &TEST
adapter: postgresql
encoding: utf8
database: project_test
pool: 5
username:
password:
production:
adapter: postgresql
encoding: utf8
database: project_production
pool: 5
username:
password:
cucumber:
<<: *TEST
I then pushed this to github.
On the Heroku website I connect the github directory to my app and deploy it.
It successfully deploys but the page only says
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
I am pretty certain I am missing a step as whenever I try to run it on my local machine it says
ActiveRecord::NoDatabaseError
FATAL: database "project_development" does not exist
Extracted source (around line #661):
659 rescue ::PG::Error => error
660 if error.message.include?("does not exist")
661 raise ActiveRecord::NoDatabaseError.new(error.message, error)
662 else
663 raise
664 end
--
EDIT
When I input
heroku run rake db:create
I get the response
▸ Error: No app specified ▸ Usage: heroku run --app APP ▸ We don't know which app to run this on. ▸ Run this command from inside an app folder or specify which app to use with --app APP
When I run
heroku run rake db:create -app nguyen-andrew-a2
I get the response
Running rake db:create nguyen-andrew-as2 on ⬢ pp... !!! ▸ Couldn't find that app. Macbook-Pro-5:try2 andrew$
--
On my local machine, after running it the page now says
fe_sendauth: no password supplied
Extracted source (around line #651):
649 # connected server's characteristics.
650 def connect
651 @connection = PGconn.connect(@connection_parameters)
652
653 # Money type has a fixed precision of 10 in PostgreSQL 8.2 and below, and as of
654 # PostgreSQL 8.3 it has a fixed precision of 19. PostgreSQLColumn.extract_precision