CodeIgniter - 其他dbforge / migration字段 [英] CodeIgniter - Additional dbforge / migration fields
本文介绍了CodeIgniter - 其他dbforge / migration字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要以下2
`last_login` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
$ b b
和
`created` datetime NOT NULL DEFAULT'0000-00-00 00:00:00'
我已经从tank_auth库的SQL插入语句复制了这些。
$
但是现在我想把它加入迁移。
方案
您可以使用
$ this-> dbforge-> add_field last_login TIMESTAMP');
或
$ data = array(
'type'=>'TIMESTAMP'
);
此自动插入ON UPDATE CURRENT_TIMESTAMP
Im having trouble figuring out this migrations business for CodeIgniter ... I cant find any decent documentation that explains additional field elements like current_timestamp, default datetime values etc etc
I was wondering if someone could help me out to translate the following into proper dbforge->add_field arrays
I need the following 2
`last_login` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
and
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
I have copied these from the SQL insert statement from the tank_auth library.
But i want to put it into migrations now.
Cheers,
解决方案
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
这篇关于CodeIgniter - 其他dbforge / migration字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文