Discussion:
[Liquibase-user] Insert current date using liquibase <insert>
Ramya Kalepu
2012-02-01 00:24:57 UTC
Permalink
Hi,

I am trying to insert data using liquibase insert tag. It works fine when I
am inputing a number to <value>.
But I am looking for a simple function that will take care of default date
(current DateTime of database) even when I don't have it as part of my
table definition.

Eg:

<changeSet id="abc_1" author="Me">
<insert tableName="Emp" schemaName="XYZ">
<column name="name" value="Me"/>
*<column name="create_date" value ="1328055111692"/>*
<column name="profile_last_update" value="currentDateTimeFunction"/>
<column name="group_name" value="BlahBlah"/>
</insert>
</changeSet>

here *<column name="create_date" value ="1328055111692"/> *works fine and
it gets inserted in to the database. I also tried using <defaultValueDate>
and <valueDate> but they also need a date in some format.

I am some function like *currentDateTimeFunction *that would be converted
to UNIX_TIMESTAMP() or SYSDATE or now() based on type of database I am
using. Please help me.

Thank you.
Ramya

Loading...