Rails - how to store large numbers like 100000076685963

I need to store large numbers, for example: 100000076685963

What are the large values ​​for the db integer field type. In my db migration, I use:

  t.integer :fb_uid

what type of field should be used for large numbers?

thank

+3
source share
3 answers

You can use a fixed point data type such as decimal with great precision. Based on the quantity you specified, accuracy of 15 will work, but you must determine exactly what range you expect.

t.decimal :fb_fluid, :precision => 15
+3
source

Try a bobber

t.float :fb_uid

, - Facebook (, facebooker), , ,

t.string :fb_uid
+3

You need to set the field limitfor the column to get Postgresql precision bigint:

t.integer :fb_uid, limit: 8
+1
source

All Articles