Liquibase: How to set the default value of a date column to be “now” in UTC format?

前端 未结 6 547
忘掉有多难
忘掉有多难 2021-01-07 16:20

How do you set the default value of a date column to be \"now\" in UTC format? I think the answer involves the defaultValueComputed attribute on the column elem

6条回答
  •  借酒劲吻你
    2021-01-07 16:46

    As liquibase is common changelog for any database, to make it generic you should not depend on any specific database like oracle, postegres, mysql instead it should be generic enough to work for any/every database.

    Below is how it should be implemented :

    
    

    This should work for all databases, for oracle, it inserts SYSTIMESTAMP as DATA_DEFAULT.

提交回复
热议问题