Thanks! This is a great help. I was really surprised when I found that yii didn't provide support for MySQL booleans/checkbox generation out of the box.
I know there's some been debate about whether TINYINT(1) should be treated as a boolean since it can actually hold numeric values of -127 to 127. The correct data type for boolean in MySQL (5.0.5 and above) is BIT(1), which can only hold 2 values: 1 and 0.
This means that you can use the following code to support this, and STILL keep using TINYINT(1) for very small numeric values.
* Extracts the PHP type from DB type.
* @param string $dbType DB type
protected function extractType($dbType)
elseif(strpos($dbType,'float')!==false || strpos($dbType,'double')!==false)
elseif(strpos($dbType,'int')===0 && strpos($dbType,'unsigned')===false || preg_match('/(bit|tinyint|smallint|mediumint)/',$dbType))
To make the default values for bit fields work you'll also need the following change to the framework:
(sorry too new to post links)