Open solnic opened 13 years ago
Which foreign key?
by Piotr Solnica (solnic)
loaner_id and loanee_id.
by Siegfried Levin
@Siegfried: Did you use DataMapper.finalize after declaring the models, but before running DataMapper.auto_upgrade! ? It is responsible for inferring the foreign keys and setting them up so that the migration will add them.
by Dan Kubb (dkubb)
@dkubb: I do use DataMapper.finalize.
by Siegfried Levin
I'm experiencing the same problem using datamapper 1.2.0, any help well be appreciated.
i am using 1.0.2 and i am also having foreign key issues. except my issue is that i added a :required => false flag and it is not dropping the foreign key constraint
i use finalize and auto_upgrade!
@ksimard auto-upgrading is only additive, this means it only adds new tables, columns, indexes (and foreign keys someday). It will never remove or rename things. In DM2 we may have it make changes that we can determine are "safe", but otherwise in DM1 auto-upgrading will never change something that already exists.
With the two models.
auto_upgrade! create no foreign key in database. ( see attachment).
Created by Siegfried Levin - 2011-03-02 05:24:36 UTC
Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/1493