0
I am developing an application in Rails and the following error appears in my bank when I try to perform a rake db:migrate. I already tried to drop the bank and create in sequence, however the same error happens. The curious thing is that it was working normally and there was no change in the "products" module of the application.
Activerecord::Statementinvalid: PG::Undefinedtable: ERROR: "products" relation does not exist LINE 5: WHERE a.attrelid = '"products"':regclass ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, >a. atttypmod FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"products"':regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum
class CreateProducts < ActiveRecord::Migration
def change
create_table :products do |t|
t.references :type
t.string :mark
t.string :model
t.string :engine
t.text :description
t.string :barcode
t.timestamps
end
add_index :products, :type_id
end
end
Post the code of the breaking Migration.
– Alex Takitani
Probably some Migration that is running before the one that creates the product table is referencing the table, check the previous Migrations.
– Alex Takitani
Alex, I was able to find the problem. I am testing Active Admin and I believe that the relationship should be done in the interface of admin tb. I commented on the interface I was editing and the migration was done. Problem solved. Thanks.
– ygorbr