CodeIgniter Forums
On Update Database Forge Fields - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: On Update Database Forge Fields (/showthread.php?tid=67007)



On Update Database Forge Fields - EpicKris - 01-01-2017

Is it possible to specify the 'on update' section of a new field like the below snippet? Or this something that can be considered for CI4?

I know I can create the field manually, but it looks a lot cleaner like this, especially for developer on-boarding.

PHP Code:
$this->forge->addFields([
    
'field_name' => [
        
'type' => 'DATETIME',
        
'default' => 'CURRENT_TIMESTAMP',
        
'update' => 'CURRENT_TIMESTAMP'
    
]
]);
$this->forge->createTable('table_name'); 



RE: On Update Database Forge Fields - kilishan - 01-01-2017

That's an interesting feature request. I'd have to see how it scales across the different platforms that we plan to support to see how feasible it is, though.


RE: On Update Database Forge Fields - EpicKris - 01-02-2017

(01-01-2017, 08:46 PM)kilishan Wrote: That's an interesting feature request. I'd have to see how it scales across the different platforms that we plan to support to see how feasible it is, though.

If it is feasible I'd be happy to create a pull request.