简体   繁体   中英

Ruby on Rails App with MySQL database

Rails 3.2 , Using MySQL database . 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. 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 .

However, I think that phone numbers are better stored as strings than integers, since you may need to represent leading zeroes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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