jeudi 23 avril 2015

Prevent rake migrate from creating foreign key constraint

We have a case in which one of the table column name use a suffix "_id". The migration code :

create_table :companies do |t|
  t.integer :ref_id  
  t.string :name
end

When running db:migrate, it fails, because rails tried to create a foreign key constraint for ref_id, and found that there is no table called "refs". In our case "ref_id" is not a foreign key.

Is there a way for us to prevent rails to create foreign key constraint for that column?

Aucun commentaire:

Enregistrer un commentaire