ruby on rails - Prevent rake migrate from creating foreign key constraint -


we have case in 1 of table column name use suffix "_id". migration code :

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

when running db:migrate, fails, because rails tried create foreign key constraint ref_id, , found there no table called "refs". in our case "ref_id" not foreign key.

is there way prevent rails create foreign key constraint column?

it seems have schema_plus gem. can do:

create_table :companies |t|   t.integer :ref_id, foreign_key: false     t.string :name end  

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -