I'm looking for something similar to this SQL.
column_name my_timestamp_column NOT NULL DEFAULT CURRENT_TIMESTAMP
Note that I require that the name of the column be specifiable, so the timestamps
macro is not suitable.
You can execute SQL in migration like this
def change do
execute("ALTER TABLE some_table ADD some_column timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP")
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.