rsim/oracle-enhanced — Issue #141: Rails 3.1.1 - foreign key without primary key
Author: danpersa
Created: 2012-01-13 15:38:00+00:00
State: open

I have a rails migration with the following line:

add_foreign_key("tramounts_aud", "revinfo", {:column=>"rev", :primary_key=>nil, :name=>"fkf32a9a0edf74e053"})

this migration line should generate the next following SQL code:

ALTER TABLE "TRAMOUNTS_AUD" ADD CONSTRAINT "FKF32A9A0EDF74E053" FOREIGN KEY ("REV") REFERENCES "REVINFO"("REV")

but instead it generates the following:

OCIError: ORA-00904: "ID": invalid identifier: ALTER TABLE "TRAMOUNTS_AUD" ADD CONSTRAINT "FKF32A9A0EDF74E053" FOREIGN KEY ("REV") REFERENCES "REVINFO"("ID")

the difference is that it puts ``ID`` instead of the requested column, ``REV`` (the ``revinfo`` table does not have an ``ID`` column)