CodeIgniter - Additional dbforge / migration fields

不打扰是莪最后的温柔 提交于 2019-12-04 20:50:43
user1620802

for number 1 you can use

$this->dbforge->add_field('last_login TIMESTAMP');

or

$data = array(
 'type' => 'TIMESTAMP'
);

This auto inserts ON UPDATE CURRENT_TIMESTAMP

I think you may be out of luck. These are the available options to dbforge:

Additionally, the following key/values can be used:

unsigned/true : to generate "UNSIGNED" in the field definition.
default/value : to generate a default value in the field definition.
null/true : to generate "NULL" in the field definition. Without this, the field will >     default to "NOT NULL".
auto_increment/true : generates an auto_increment flag on the field. Note that the >     field type must be a type that supports this,
such as integer

You may have to pass a standard query. $this->db->query('YOUR QUERY HERE'); may be what you need.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!