如何使用Rails 2.1和MySQL定义BigInt主键? [英] How can I define a BigInt primary key with Rails 2.1 and MySQL?
本文介绍了如何使用Rails 2.1和MySQL定义BigInt主键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从Rails 2.1开始,如果您在迁移中定义了一个新列,其类型设置为:integer,而:limit设置为5或更大,则在MySQL数据库中实际创建的列将为BigInt类型.太完美了.
Since Rails 2.1, if you define a new column in a migration with the type set to :integer and the :limit set to 5 or more, the column actually created in your MySQL database will be of type BigInt. That's perfect.
但是我不知道如何使用BigInt主键创建表.
But I cannot figure out how to create a table with a BigInt primary key.
有任何线索吗?
推荐答案
我偶然发现了此插件:似乎可以回答这个问题.
I just stumbled upon this plugin: it seems to answer this very question.
这篇关于如何使用Rails 2.1和MySQL定义BigInt主键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文