Open GoogleCodeExporter opened 9 years ago
Original comment by qiang.xue
on 7 Dec 2009 at 4:27
@Sebastián: could you take care of this? To be honest, I don't know how to
deal with
this. I think we should treat enum as string type. But what should be the max
size?
Original comment by qiang.xue
on 5 Jan 2010 at 2:10
[deleted comment]
[deleted comment]
["test"]=> object(CMysqlColumnSchema)#20 (13) { ["name"]=> string(4) "test"
["rawName"]=> string(6) "`test`" ["allowNull"]=> bool(false) ["dbType"]=>
string(17) "enum('asd','dsa')" ["type"]=> string(6) "string"
["defaultValue"]=>
NULL ["size"]=> int(0) ["precision"]=> int(0) ["scale"]=> int(0)
["isPrimaryKey"]=> bool(false) ["isForeignKey"]=> bool(false)
["_e:private"]=>
NULL ["_m:private"]=> NULL }
We can use the dbType (enum 'asd', 'dsa') and extend the
extractLimit method in CMysqlColumnSchema with something like this:
protected function extractLimit($dbType)
{
if ($dbType is enmu){
$this->size = 0;
foreach($enumPossibilites as $enumOption)
$this->size = max($this->size, $enumOption);
else
parent::extractLimit($dbType);
}
Original comment by sebathi
on 5 Jan 2010 at 3:46
Is it possible to get $enumPossibilites? If so, I agree with this solution.
Original comment by qiang.xue
on 5 Jan 2010 at 1:59
Yes, the $dbType will be as follows - all the line:
enum('asd', 'test', 'veryLongEnum')
Original comment by sebathi
on 5 Jan 2010 at 2:05
Fixed r1664
Original comment by sebathi
on 5 Jan 2010 at 2:24
Migrated to http://github.com/yiisoft/yii/issues/3
Original comment by qiang.xue
on 15 Feb 2012 at 6:36
Migrated to http://github.com/yiisoft/yii/issues/43
Original comment by qiang.xue
on 15 Feb 2012 at 6:44
Original issue reported on code.google.com by
eMule.maya@gmail.com
on 30 Oct 2009 at 7:52