简体   繁体   English

Ruby on Rails应用程序与MySQL数据库

[英]Ruby on Rails App with MySQL database

Rails 3.2 , Using MySQL database . Rails 3.2,使用MySQL数据库。 What datatype should I use to the field of Phone number? 我应该在电话号码字段中使用什么数据类型?

Am currently using t.integer, but its not supporting the length of Phone number which has more than 12 digits. 我目前正在使用t.integer,但它不支持超过12位数的电话号码的长度。 Please Help! 请帮忙!

You could use 64-bit integers (which can store numbers as high as 9,223,372,036,854,775,807), as described here . 你可以使用64位整数(可存储数高达9,223,372,036,854,775,807),如所描述这里

However, I think that phone numbers are better stored as strings than integers, since you may need to represent leading zeroes. 但是,我认为电话号码最好存储为字符串而不是整数,因为您可能需要表示前导零。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM