Mysql formats for some data types


Maximum length id 254 characters. May contain non-ASCII characters. So it's NVARCHAR(254) CHARACTER SET utf8.

Latitude and Longitude

About length - 3 + 6 decimal digits (in degrees) are accurate to ~10 cm. Details: 1, 2. In mysql format it will look like DECIMAL(9,6).

md5 hash

CHAR(32) CHARACTER SET latin1. I hope you don't use it for storing passwords.

CPasswordHelper hash

Documentation says you should use CHAR(64) CHARACTER SET latin1.

Apple Device Token

Device token is a 64-charred hex-string so it must match regexp like this: ~^[0-9a-f]{64}$~. Mysql type is CHAR(64) CHARACTER SET latin1.

Facebook ID

This may be used for storing user and apge ids provided by facebook api. Mysql type is bigint(20) unsigned.

Categories: Tips