轨道迁移。修改auto_increment的起点
我已经创建了一个表。我正在寻找 Rails 迁移,可以在其中修改表的 id
列的 auto_increment
数字的起点。假设我希望它从 1000
开始。
我用谷歌搜索了一下,发现这个:
它说:
:options "string" 将原始选项传递给 你的底层数据库,例如 auto_increment = 10000。请注意 传递选项会让你失败 默认 ENGINE=InnoDB 语句
可以用于我想要的东西吗?由于我正在更改列而不是创建新列,迁移会是什么样子......
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 "string" 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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用原始 execute 方法
You can use raw execute method