protected function deriveMetaDatatype(ValidationExpression $ve)
 {
     $v = $ve->getValidationArray();
     $datatype = $v['datatype'];
     switch ($datatype) {
         case 'flag':
             return 'flag';
         case 'boolean':
             return 'tiny';
         case 'date':
             if (isset($v['unix']) && !StringUtils::strToBool($v['unix'])) {
                 return 'datetime';
             }
             // If unix attribute is not specified, assume they want date (timestamp) for backward-compatibility
             return 'date';
         case 'int':
             $min = isset($v['min']) ? (int) $v['min'] : 0;
             $max = isset($v['max']) ? (int) $v['max'] : PHP_INT_MAX;
             if ($min < 0) {
                 if ($min >= -128 && $max <= 127) {
                     return 'tiny-signed';
                 } else {
                     if ($min >= -2147483648 && $max <= 2147483647) {
                         return 'int-signed';
                     }
                 }
                 return 'long-signed';
             }
             if ($max < 255) {
                 return 'tiny';
             } else {
                 if ($max <= 4294967295) {
                     return 'int';
                 }
             }
             return 'long';
         case 'float':
             return 'float';
         case 'slug':
         case 'slugwithslash':
         case 'email':
             $ve->setMax(255);
             // set max
             return 'varchar';
         case 'json':
             $ve->setMax(262144);
             //set max to 256K
             return 'mediumtext';
         case 'string':
         case 'html':
         case 'url':
             // NOTE: MySQL columns are bytes, string lengths are characters
             $max = 255;
             // default is 255
             if (isset($v['max'])) {
                 $max = (int) FileSystemUtils::iniValueInBytes($v['max']);
             }
             if ($max == 65536) {
                 $max = 65535;
             }
             if ($max > 262144) {
                 // max is 256K
                 $max = 262144;
             }
             $ve->setMax($max);
             // set max
             if ($max <= 255) {
                 // 255 or less is VARCHAR
                 return 'varchar';
             }
             if ($max <= 65535) {
                 // 64K or less is TEXT
                 return 'text';
             }
             if ($max <= 262144) {
                 // 256K or less is MEDIUMTEXT
                 return 'mediumtext';
             }
         case 'binary':
             $max = 262144;
             // default is 256K
             if (isset($v['max'])) {
                 $max = (int) FileSystemUtils::iniValueInBytes($v['max']);
             }
             if ($max == 65536) {
                 $max = 65535;
             }
             if ($max > 262144) {
                 // max is 256K
                 $max = 262144;
             }
             $ve->setMax($max);
             // set max
             if ($max <= 65535) {
                 // 64K or less, store as BLOB
                 return 'blob';
             }
             if ($max <= 262144) {
                 // 256K or less, store as MEDIUMBLOB
                 return 'mediumblob';
             }
     }
 }