Rails的迁移:BIGINT在PostgreSQL上似乎是失败的? [英] Rails Migration: Bigint on PostgreSQL seems to be failing?

查看:152
本文介绍了Rails的迁移:BIGINT在PostgreSQL上似乎是失败的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想创建一个表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.

这篇关于Rails的迁移:BIGINT在PostgreSQL上似乎是失败的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆