I create a ENUM field, here is my code:
$field['test'] = array(
'type' => 'ENUM',
'constraint' => array('a','b','c'),
'default'=> "a"
);
$this->dbforge->add_field($field);
$this->dbforge->create_table('demo');
And I got a message:
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘Array) DEFAULT ‘a’ NOT NULL ) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci’ at line 2
CREATE TABLE
ci_demo
(test
ENUM(Array) DEFAULT ‘a’ NOT NULL ) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Please help me, thank you very much.
Try this one
Reference