As the title says, I clones a rails API. I tried to follow the steps in this article from point 2 onwards https://dev.to/w3ndo/a-checklist-for-setting-up-a-cloned-rails-application-locally-5468 but I keep getting the same error from db:setup onwards.
Please help!
I have tried googling the answer and phoning a friend.
I have tried rails db:setup, rails db:seed, rails db:create, rails db:migrate.
Update: So I found I was getting this error because the db owner was listed as the original owner in the repo but when I typed psql in terminal and located the db, the owner was listed as me.
I was able to change this using PGadmin 4 and type in the original owner as the db owner.
3
Answers
Update
Thank you for the help. I was able to find out as my partner had created the backend, the issue was arising because the owners of the database didn't match when I cloned his repo.
You want to initialize the postgres db, which doesn’t quite come for free. I recommend using sqlite3 until you need a production db. If the clone calls for PG, then:
sudo su - postgres
createuser --interactive
sudo systemctl restart postgresql
bundle exec rails db:create:all
$
pg_isready
tells you at a glance if posgtres server/cluster is online.If it gets frustrating, change the
config/database.yml
to the default version, remove pg gem if possible, add sqlite3. Then simplerake db:migrate
after creating or adding an [environment].sqlite3 file to db/So I found I was getting this error because the db owner was listed as the original owner in the repo but when I typed psql in terminal and located the db, the owner was listed as me.
I was able to change this using PGadmin 4 and type in the original owner as the db owner.