> Agreed. My intention was to update the columns method on the connection > adapter to set the primary attribute to true for the primary key. The one > thing which we ran into while doing some work on this is that for tables > with a primary key that is made up of more then one field we probably need > to take the declaration of the primary key out of the table definition and > put it as a seperate "add_primary_key" method that would then be recognized > by ActiveRecord::Migration.
I don't think rails supports primary keys across multiple columns, though work may be being done on this. Currently though, many methods (such as find(id)) assume a single-column primary key. I'm not sure the best way to resolve this. I'd probably look to getting it working without multiple column PKs, then building on that. Also, its worth considering how to get the PK from a table definition. I think the PK belongs to the table, rather than just being a property of a column. > The only downside that I can think of is that the query for retrieving > columns with a primary key may be more costly then a query just for the > column details. For the SQL Server Adapter getting the primary key requires > including a LEFT OUTER JOIN on a sub-query. In production mode this won't be an issue as the columns information is only loaded once. Tom
_______________________________________________ Rails-core mailing list [email protected] http://lists.rubyonrails.org/mailman/listinfo/rails-core
