текущая дата + 30 дней не исользуя триггер?
через default constraint, по идее
Можно пример
https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html
MariaDB [phpmyadmin]> create table t123 ( -> id int, -> expire timestamp default DATE_SUB(NOW(), INTERVAL -30 DAY) -> ); Query OK, 0 rows affected (0.00 sec) MariaDB [phpmyadmin]> insert into t123 (id) select 1; Query OK, 1 row affected (0.00 sec) Records: 1 Duplicates: 0 Warnings: 0 MariaDB [phpmyadmin]> select * from t123; +------+---------------------+ | id | expire | +------+---------------------+ | 1 | 2022-07-30 12:42:55 | +------+---------------------+ 1 row in set (0.00 sec)
Обсуждают сегодня