Rails-如何存储像100000076685963这样的大量数字 [英] Rails - how to store large numbers like 100000076685963

查看:55
本文介绍了Rails-如何存储像100000076685963这样的大量数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要存储大量的数字,例如:100000076685963

I need to store large numbers like :100000076685963

对于整数的db字段,这将很大。在我的数据库迁移中,我使用:

Which are to big for a db field type of integer. In my db migration I use:

  t.integer :fb_uid

像这样的大数应该使用哪种字段类型?

what field type should I use for large numbers like this?

谢谢

推荐答案

尝试浮动

t.float :fb_uid

似乎与Facebook(可能是facebooker)有关,并且假设这些数字不会用作算术运算,您可能只使用字符串

And seems like this is something to do with Facebook (probably facebooker) and assuming these numbers will not use as arithmetic operations, you could probably use just string

t.string :fb_uid

这篇关于Rails-如何存储像100000076685963这样的大量数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆