加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sql – Liquibase:如何设置UTC格式的“now”的日期列的默认值?

发布时间:2020-12-12 16:31:42 所属栏目:MsSql教程 来源:网络整理
导读:如何将UTC格式的日期列的默认值设置为“now”我认为答案涉及 column element上的defaultValueComputed属性. 文件规定: defaultValueComputed A value that is returned from a function or procedure call. This attribute will contain the function to cal
如何将UTC格式的日期列的默认值设置为“now”我认为答案涉及 column element上的defaultValueComputed属性.

文件规定:

defaultValueComputed A value that is returned from a function or
procedure call. This attribute will contain the function to call.

什么标准是被称为应该写的功能? Java的?该函数应该是要使用的数据库供应商特定日期函数吗?有没有更多关于这个话题的文件?

解决方法

也许 this topic在液碱论坛会有帮助吗?

我认为defaultValueComputed将采用一个特定于数据库的函数来表达“now”.在mySQL中,它将是CURRENT_TIMESTAMP,因此它可能如下所示:

<createTable tableName="D_UserSession">
    <column name="ts" type="TIMESTAMP" defaultValueComputed="CURRENT_TIMESTAMP"/>
</createTable>

(从论坛帖子复制.)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读