-
ProblemI'm following steps in the backend/README.md file and it seems that the essential part about connecting to database is missing. when I execute one of the following commands: rails db:create db:migrate rails db:seed rspec spec I get error like
What have I tried to fix this error myself?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
To setup the dev database you have to install PostgreSQL 14 on your local machine. WindowsDownload Postgres from here and follow the setup wizard. MacOSbrew install postgresql
brew services start postgresql Linuxsudo apt install -y postgresql postgresql-contrib libpq-dev build-essential
sudo -u postgres psql --command "CREATE ROLE \"`MY_USERNAME`\" LOGIN createdb superuser;" Maybe it also works with docker, but I've never tried it. |
Beta Was this translation helpful? Give feedback.
-
Oh man... it was my fault. I didn't check that my db is accepting connections. I needed to expose 5432 port correctly. Also, I've added these missing properties to development and test environments in the database.yml file: username: potter_db_api
password: <%= ENV["POTTER_DB_API_DATABASE_PASSWORD"] %> without this change, when running
And with this change, the db migrations run successfully. |
Beta Was this translation helpful? Give feedback.
Oh man... it was my fault. I didn't check that my db is accepting connections. I needed to expose 5432 port correctly.
Also, I've added these missing properties to development and test environments in the database.yml file:
without this change, when running
rails db:create db:migrate
, I've got this error:And with this change, the db migrations run successfully.
Thank you for your help and let's close the discus…