Rails的迁移:BIGINT在PostgreSQL上似乎是失败的?似乎是、Rails、BIGINT、PostgreSQL

由网友(╭╮)分享简介:想创建一个表BIGINT列创建了一个标准的整数列代替。可能是什么问题呢?我不知道从哪里开始寻找。Trying to create a table with a bigint column creates a standard integer column instead. What could be going wr...

想创建一个表BIGINT列创建了一个标准的整数列代替。可能是什么问题呢?我不知道从哪里开始寻找。

Trying to create a table with a bigint column creates a standard integer column instead. What could be going wrong? I don't know where to start looking.

我在迁移中使用这样的:

I'm using this in the migration:

create_table :table_name do |t|
  t.integer :really_big_int, limit: 8
end

我使用Ruby 1.9.2和PostgreSQL 9.0.3和Rails 3.0.9。我已经放弃了数据库和运行迁移几次,它仍然无法创建BIGINT列。

I'm using Ruby 1.9.2, PostgreSQL 9.0.3 and Rails 3.0.9. I've dropped the database and ran the migrations several times and it still doesn't create the bigint column.

推荐答案

由于某种原因,创建表不喜欢BIGINT。你可以,但是使用BIGINT数据类型与add_columm做到这一点:

For some reason the create table doesn't like bigint. You can, however do it with add_columm using the bigint data type:

add_column :table_name, :really_big_int, :bigint

那么你不需要该限制的东西。

Then you don't need that limit stuff.

阅读全文

相关推荐

最新文章