sql - PGError : ERROR: column "is_required" is of type boolean but expression is of type integer

标签 sql ruby-on-rails sqlite postgresql heroku

我正在尝试对 Heroku 执行 db:push,但出现此错误:

!!! Caught Server Exception
HTTP CODE: 500
Taps Server Error: PGError: ERROR:  column "is_required" is of type boolean but expression is of type integer
LINE 1: ..." ("id", "question_id", "text", "response_class", "is_requir...
                                                             ^
HINT:  You will need to rewrite or cast the expression.

我正在从本地数据库(sqlite)推送到 Heroku 的 PostgreSQL 数据库。

is_required 列使用 t.boolean "is_required", :default => false 设置为 bool 值。

不确定在这里做什么。

最佳答案

在 pgAdmin 中玩转;看起来 postgres 更喜欢 't''f' 形式的默认值。不过,我没有安装 ruby​​ 来试用它。

关于sql - PGError : ERROR: column "is_required" is of type boolean but expression is of type integer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7947814/

相关文章:

ruby-on-rails - RoR Passenger Web 服务器 gem 检查时出现 "Extra File"错误 --alien

javascript - 服务器不断得到旧结果

mysql - 如果不存在则sql插入,否则(完全不同)更新

php - 将最后一次 mysql 查询的信息保存到历史表中

mysql - 如何将带有 LOCK TABLE 的 SQL 查询转换为带有 SELECT...FOR UPDATE 的存储过程

mysql - 使用 DENSE_RANK() MySQL 缺少右括号

css - 如何在 Rails 元素中更改 application.css 的名称?

sql - PL/SQL FETCH NEXT 或 rownum

ruby-on-rails - aws-s3 gem 和 right_aws gem 之间的 Rails Paperclip 冲突。怎么解决?

ruby-on-rails - rails 3 : Sort a ActiveRelation by Ratings Counted from another table