I have a h2 database with a schema that is auto generated via JPA/hibernate. Now I want to alter a not-null timestamp
type column on the database to default to the current time.
I actually use a trigger, and that works, but I'd like to know if there's a more elegant way to achieve this, something like (the following snippet doesn't work)
ALTER TABLE my_table ALTER COLUMN my_column SET DEFAULT CURRENT_TIMESTAMP;
I looked at the documentation and tried some variants of the above "pseudo statement" but with now success.
Looks close, have you tried:
ALTER TABLE <table name> ALTER COLUMN <column name> SET DEFAULT CURRENT_TIMESTAMP
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With