Ask A Question

Notifications

You’re not receiving notifications from this thread.

Postgres issues

Tom Dringer asked in Databases

Hi,

So as i began a project earlier in the year, i decided to go full Docker for deployment. That was all good except debugging and stuff proved difficult so this weekend i decided to make the project native and use something for deployment.
Long story short, now i have gone back to a native based project (i.e no Docker), my Postgres installation (which was fine in the beginning) now just does not work.
I had issues with port numbers (which i have since managed to fix) and no issues with database not found. To make things worse, i think (i'm on macos and using Rubymine) i have Postgres installed via the OS, multiple versions by Homebrew, and some from standalone Postgres apps.
So obviously with these issues, i can;t start my app or run migrations etc.

Has anyone had this issue when moving away from Docker?

My error at the moment is no database named "xxx". I thought when i did i migration its all taken from the database.yml? I've run commands like rake db:create and similar.

I'm not totally sure the db i am connected to is even the right one.

Reply

I now have Postgres running on my local machine nicely. My issue now is i can't run a migration due to the following error:

ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "drivers" does not exist
LINE 8: WHERE a.attrelid = '"drivers"'::regclass

There should be a relationship between a user and a driver, where the user has one driver.

In my user (Devise) model I have has_one :driver

and in my driver migration I have:

t.string :user_id
t.belongs_to :user

So in the driver table the user_id field should hold the user.id.

Any direction is appreciated.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.