PG::UndefinedTable: ERROR: relation 'caves' does not exist

kdweber89

I've ran into a problem in which I'm not sure how to get out of this. Working on creating a rails view, and after populating my view and editing my controller, i've ran into an error that states PG::UndefinedTable: ERROR: relation 'caves' does not exist

Looking into what I did, I realized that I created my model as cafe but when I populated my schema tables, I accidentally created a table called caves instead of cafes.

Here's what I did to try to resolve this.

  1. I first tried creating a migration to just rename the table from caves to cafes -- still ran into the same error
  2. I then tried deleting the schema table all together and creating a new one all together called cafe - still ran into the same error
  3. I then tried dropping my database all together, thinking if I just wiped the whole thing and started over (i just started on this rails project). I ran rake db:reset only to come into a new error telling me ActiveRecord::StatementInvalid: PG::ObjectInUse: ERROR: database "cafe_database" is being accessed by other users
  4. By this point, I tried restarted my postgress and ran sudo service postgresql restart....but my machine doesn't recognize service

Does anybody have an idea what I can do to figure this problem out? I'm running out of ideas.

puneet18

try below steps:

1. rake db:drop
2. rake db:create
3. rake db:migrate

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

PG::UndefinedTable: ERROR: relation "..." does not exist

PG::UndefinedTable: ERROR: relation "entries" does not exist

Installing Devise: `PG::UndefinedTable: ERROR: relation "users" does not exist`

ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "guestbooks" does not exist

PG::UndefinedTable: ERROR: relation "step_images" does not exist

PG::UndefinedTable - ERROR: relation "active_storage_attachments" does not exist

Rails - PG::UndefinedTable: ERROR: relation "customers" does not exist

PG::UndefinedTable: ERROR: relation "active_storage_blobs" does not exist

rake aborted! PG::UndefinedTable: ERROR: relation "pages" does not exist

ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation table does not exist)

heroku postgresql database rails app PG::UndefinedTable: ERROR: relation "comments" does not exist

Rails join table name doesn't match migration or schema (PG::UndefinedTable: ERROR: relation does not exist)

ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "spree_orders" does not exist

PG::UndefinedTable: ERROR: relation "" does not exist - Amazon EC2, Postgresql, and Rails 5

PG::UndefinedTable: ERROR: relation "action_text_rich_texts" does not exist | Rails 6 | Rails_Admin | Postgresql

PG::UndefinedTable: ERROR: table "table-name" does not exist

Rails ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "pg_range" does not exist LINE 3: LEFT JOIN pg_range as r ON oid = rngtypid

pg_restore ERROR: “Relation does not exist” and creating new database

psycopg2.errors.UndefinedTable: relation does not exist (join table)

i18n-active_record PG::Error: ERROR: relation "translations" does not exist (rails 4)

Pg:Error column does not exist

PG::UndefinedColumn: ERROR: column "city_id" of relation "events" does not exist

Relation does not exist error using WITH

JPA ERROR: relation does not exist

psycopg2.errors.UndefinedTable: relation “exercises” does not exist - Django Testing

psycopg2.errors.UndefinedTable: relation "authentication_author" does not exist: Django v4

PostgreSQL Error "ERROR: relation "user" does not exist"

Heroku database error on production: PG::UndefinedTable Error

Sidekiq PG::UndefinedColumn: ERROR: does not exist