How to add decimal field to Codeigniter migration file?

When writing codeigniter migration, I'm not sure how to proceed with adding a decimal type field. in particular, how do you determine the size of an element that is allowed? For example, how would I define an array to go to dbforge->add_field() to create a field similar to the following:

 price decimal(10,2) not null default 0.00 
+6
source share
3 answers
 'price' => array( 'type' => 'DECIMAL', 'constraint' => '10,2', ), 
+18
source
 'price' => array( 'type' => 'DECIMAL', 'constraint' => '10,2', 'null' => FALSE, 'default' => 0.00 ), 
+2
source
 'price' => array('type' => 'DECIMAL(10,2)') 
0
source

Source: https://habr.com/ru/post/913137/


All Articles