doufei1988 2017-02-17 16:56
浏览 55

如何将Datetime设置为Codeigniter迁移列的类型

I am doing a migration file, and there is a field on a table wich type should be DateTime, and the default value CURRENT_TIMESTAMP. What I have until now is the next:

'date'  => array(
    'type' => 'DATETIME',
),

I think it is right... but I still need set the default value... definitely, what I want to do is make the translation from sql to codeigniter migration of this:

`date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP

Thanks in advance.

  • 写回答

2条回答 默认 最新

  • dougan4884 2017-02-17 17:10
    关注

    You can try like this.Need to use timestamp.See an example below..

       'created_at' => array('type' => 'timestamp')
    
    评论

报告相同问题?

悬赏问题

  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败