duanliao3826 2019-07-04 13:47
浏览 465

让数值超出范围,但我已经创建了BigInt

I have a table, and one of the columns is request_id, which is defined in a migration like this:

$table->bigInteger('request_id')->index()->unsigned()->nullable();

And when I look on phpmyadmin at the table structure, it says

bigint(20)      UNSIGNED

I'm making a request to my api, and sending through this value: 1562247865319

$requestLog = new RequestLog();
$requestLog->request_id = 1562247865319;
$requestLog->save();

This code is erroring and sending back Numeric value out of range: 1264 Out of range

What's really strange is that when I'm in phpmyadmin, I can manually set the value of that column to much bigger values than 1562247865319, but when I do it through my laravel model it doesn't like it.

edit

error message is

SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'request_id' at row 1 (SQL: insert into `request_logs` (`ip`, `submitted_user_name`, `url`, `full_url`, `method`, `request_id`, `request_data`, `api_user_id`, `updated_at`, `created_at`) values (..., ..., ..., http://..../api/..., POST, 1562247865319, {"request_id":"1562248616206"}, 2, 2019-07-04 14:57:00, 2019-07-04 14:57:00))
  • 写回答

1条回答 默认 最新

  • doumeba0486 2019-07-04 13:51
    关注

    I think this issue is the same than this.

    Try to change any UNSIGNED ints to SIGNED.

    评论

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程