开发者

Auto-incrementing from 0 in Rails migrations

I needed an id field in my ra开发者_C百科ils migration that auto-increments from 0 and not 1.Any idea? Thanks & Cheers !


I found it in mysql Advance option "The initial AUTO_INCREMENT" value for the Table. you can set there but i don't know whether you can set that using Rails Migration or not.


Modify your db/migrate-file:

create_table :table_name, :options => "auto_increment = 0" do |t|
  ...
end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜