Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Codeigniter迁移文件中添加十进制字段?_Codeigniter_Migration - Fatal编程技术网

如何在Codeigniter迁移文件中添加十进制字段?

如何在Codeigniter迁移文件中添加十进制字段?,codeigniter,migration,Codeigniter,Migration,在编写codeigniter迁移时,我不知道如何添加十进制类型的字段。具体来说,如何定义允许的元素的大小?例如,如何定义要传递到dbforge->add_field()的数组,以便创建如下字段: price decimal(10,2) not null default 0.00 如果您对答案进行编辑以添加一些解释,您的答案会更有用。 'price' => array( 'type' => 'DECIMAL', 'constraint' => '10,2', )

在编写codeigniter迁移时,我不知道如何添加十进制类型的字段。具体来说,如何定义允许的元素的大小?例如,如何定义要传递到
dbforge->add_field()
的数组,以便创建如下字段:

price decimal(10,2) not null default 0.00

如果您对答案进行编辑以添加一些解释,您的答案会更有用。
'price' => array(
    'type' => 'DECIMAL',
    'constraint' => '10,2',
),
'price' => array('type' => 'DECIMAL(10,2)')
'price' => array(
'type' => 'DECIMAL',
'constraint' => '10,2',
'null' => FALSE,
'default' => 0.00
),