Ruby-on-rails – rails – how to store large numbers, such as 100000076685963

I need to store a lot of numbers: 100000076685963

For the integer of the db field type, which is the larger one. In my database migration, I use :

t.integer :fb_uid

What field type should I use for such large numbers?

Thank you

You can use fixed-point data types with large precision, such as Decimal. According to the number you give, a precision of 15 will work, but you should know exactly what range you expect.

t.decimal :fb_fluid, :precision => 15

I need to store a lot of numbers: 100000076685963

For the integer of the db field type, which is the larger one. In my database migration, I use:

t.integer :fb_uid

What field type should I use for such large numbers?

Thank you

You can use fixed-point data types with large precision, such as decimal. According to the number you give, the precision is 15 Will work, but you should know exactly the range you expect.

t.decimal :fb_fluid, :precision => 15

Leave a Comment

Your email address will not be published.