Timestamp without change on update

后端 未结 4 1793
感情败类
感情败类 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:26

    You added a ON UPDATE condition to the column!! To remove this, redefine the column as

    ALTER TABLE `mytable` MODIFY `added_on` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
    

    This will effectively remove the ON UPDATE condition.

提交回复
热议问题