Are there some fundamental database considerations for selecting which side of one-to-one relationship should store foreign key? This question does not come up in one-to-many relationships but what are the considerations in one-to-one case? Let say for example that in my RoR application I have models for purchase order and invoice. Do I select that Order has_one Invoice and Invoice belongs_to Order or do I swap has_one/belongs_to usage? Both options provide me with methods to access order from invoice and visa versa. Given the fact that placement of belongs_to corresponds to a table which contains foreign key the equivalent question is how one decides to put order_id foreign key into Invoices table or invoice_id into Orders table? How much does it really matter which option I go with?
on 2006-12-31 00:40