Add two fields directly. In fact, you don’t need to change that field to null. You only need to judge the time at the logical level when using it. Mysql itself does not have this function
It is recommended to use the logic code layer to handle it. After all, the database is only a function of accessing data, and these functions should not be mixed. By adding an additional creation time field, the code can determine whether it has expired.
Just give a valid time field directly, and the code layer will make a logical judgment and give a null value after the validity period.
You can write a trigger and change its status after the effective time
Add two fields directly. In fact, you don’t need to change that field to null. You only need to judge the time at the logical level when using it. Mysql itself does not have this function
It is recommended to use the logic code layer to handle it. After all, the database is only a function of accessing data, and these functions should not be mixed. By adding an additional creation time field, the code can determine whether it has expired.