On 3/25/06, Michael Koziarski <[EMAIL PROTECTED]> wrote: > Hey guys, > > With the addition of has_many :through, a number of people will > probably want to add primary keys to their current 'rich association' > tables. Currently we don't have an add_primary_key. We have a ticket > for it[1], and I've attached a simple patch[2]. > > It works fine for mysql and postgres (8) and Rick is looking at sqlite. > > Could those of you who use the other database adapters please have a > look? Before 1.1 is released we should either support > add_primary_key, or raise NotImplementedError as appropriate. > > [1] http://dev.rubyonrails.org/ticket/3735 > [2] http://dev.rubyonrails.org/attachment/ticket/3735/add_primary_key.diff > --
I'm not sure about the other platforms, but the way I'd do it in Oracle is: "ALTER TABLE #{table_name} ADD #{column_name} #{native_database_types[:primary_key]}" "ALTER TABLE #{table_name} ADD PRIMARY KEY (#{column_name})" Michael S. might have a better idea of how to do it in a single statement, though. _______________________________________________ Rails-core mailing list Rails-core@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-core