开发者

rails migration. modify starting point for auto_increment

I have a table already created. I am looking for a rails migration where I can modify the starting point of the auto_increment number for id column of my table. Let's say I want it to start from 1000.

I googled a bit and came across this:

it says:

:options "stri开发者_如何学JAVAng" pass raw options to your underlying database, e.g. auto_increment = 10000. Note that passing options will cause you to lose the default ENGINE=InnoDB statement

Can this be used for something I want? and how will the migration look since i am changing the column and not creating new one...


You can use raw execute method

execute ("ALTER TABLE your_table_name AUTO_INCREMENT = 10000")
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜