0

I have a DB Table with a big int primary key. When my primary key is too large like 'xxxxxxxxxxxxxx' i get always this same value on lighthouse graphql query: 2147483647

Is there a way to declare the size of my ID? Like id:ID! BigInt

G_Dnsk
  • 21
  • 4
  • Do you really need a big int primary key? I doubt you do... – B001ᛦ Jan 28 '20 at 13:22
  • @B001ᛦ Thank you for your comment. I don't have a choice. The database is already being used this way for years. – G_Dnsk Jan 28 '20 at 13:27
  • @b001ᛦ Larave's default primary key when creating tables is bigint `$table->id();` -> `Alias of $table->bigIncrements('id')` -> Auto-incrementing UNSIGNED BIGINT (primary key) equivalent column. – SlyDave Jan 18 '21 at 13:26

2 Answers2

2

I managed to get it done by adding:

protected $keyType = 'bigint';

on the laravel model class.

G_Dnsk
  • 21
  • 4
0

Cast you your column to string in your query, and use BC Math or GMP on the PHP side.

fred727
  • 2,644
  • 1
  • 20
  • 16