Timestamp without change on update

后端 未结 4 1805
感情败类
感情败类 2020-12-19 11:50

In mysql I have a timestamp with the field name added_on. I created that for a table of leads for a crm. But it\'s getting updated whenever I updat

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-19 12:43

    The issue is the ON UPDATE CURRENT_TIMESTAMP. You should be able to undo this behavior with an alter statement like this (not sure what your table name is):

    ALTER TABLE leads MODIFY added_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
    

提交回复
热议问题