LoginSignup
3
0

More than 5 years have passed since last update.

ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "#{table_name}" does not exist

Posted at

事象

こんなエラーが出てきた

     ActiveRecord::StatementInvalid:
       PG::UndefinedTable: ERROR:  relation "#{table_name}" does not exist
       LINE 8:                WHERE a.attrelid = '"#{table_name}"'::...
                                                 ^
       :               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                            pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
                            c.collname, col_description(a.attrelid, a.attnum) AS comment
                       FROM pg_attribute a
                       LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
                       LEFT JOIN pg_type t ON a.atttypid = t.oid
                       LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
                      WHERE a.attrelid = '"#{table_name}"'::regclass
                        AND a.attnum > 0 AND NOT a.attisdropped
                      ORDER BY a.attnum

解決方法

migrationファイルが消えているので作り直す

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0