To set current timestamp as a default value in PostgreSQL, you can use the defaultNow() method or sql operator with now() function which returns the current date and time with the time zone:
The mode option defines how values are handled in the application. Values with string mode are treated as string in the application, but stored as timestamps in the database.
To set unix timestamp as a default value in PostgreSQL, you can use the sql operator and extract(epoch from now()) function which returns the number of seconds since 1970-01-01 00:00:00 UTC:
MySQL
To set current timestamp as a default value in MySQL, you can use the defaultNow() method or sql operator with now() function which returns the current date and time (YYYY-MM-DD HH-MM-SS):
fsp option defines the number of fractional seconds to include in the timestamp. The default value is 0.
The mode option defines how values are handled in the application. Values with string mode are treated as string in the application, but stored as timestamps in the database.
To set unix timestamp as a default value in MySQL, you can use the sql operator and unix_timestamp() function which returns the number of seconds since 1970-01-01 00:00:00 UTC:
SQLite
To set current timestamp as a default value in SQLite, you can use sql operator with current_timestamp constant which returns text representation of the current UTC date and time (YYYY-MM-DD HH:MM:SS):
To set unix timestamp as a default value in SQLite, you can use the sql operator and unixepoch() function which returns the number of seconds since 1970-01-01 00:00:00 UTC:
The mode option defines how values are handled in the application. In the application, values with timestamp and timestamp_ms modes are treated as Date objects, but stored as integers in the database.
The difference is that timestamp handles seconds, while timestamp_ms handles milliseconds.