Forum: Ruby on Rails how to define primary_key at migrate

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Zh P. (Guest)
on 2009-01-15 00:32
Hi, I am a newbie.

I am wondering if anyone can show me how to define a primary_key at
migrate

create table (:zis, :primary_key => 'quwie') do |t|
t.column :quwie, :integer, :limit => 4

end

Is it the right way to do it?
Philip H. (Guest)
on 2009-01-15 01:15
(Received via mailing list)
On Jan 14, 2009, at 2:32 PM, Zh Peng wrote:

>
> Is it the right way to do it?

Almost.  Don't specify the column... just the :primary_key part...

Check the docs for more info.

http://api.rubyonrails.org/classes/ActiveRecord/Co...
Zh P. (Guest)
on 2009-01-15 17:32
Thank you.

Philip H. wrote:
> On Jan 14, 2009, at 2:32 PM, Zh Peng wrote:
>
>>
>> Is it the right way to do it?
>
> Almost.  Don't specify the column... just the :primary_key part...
>
> Check the docs for more info.
>
> 
http://api.rubyonrails.org/classes/ActiveRecord/Co...
This topic is locked and can not be replied to.