sqlite_action

 

CREATE TRIGGER https://www.sqlite.org/lang_createtrigger.html

 

触发器

DROP TABLE IF EXISTS user_token;
CREATE TABLE IF NOT EXISTS user_token (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
token TEXT NULL,
"uid" INTEGER NULL,
"cid" INTEGER NULL,
"info" TEXT NULL,
created_at TEXT NOT NULL DEFAULT (DATETIME('now', 'localtime')),
updated_at TEXT NOT NULL DEFAULT (DATETIME('now', 'localtime'))
)
;
CREATE TRIGGER IF NOT EXISTS trigger_user_token_updated_at AFTER UPDATE ON user_token
BEGIN
UPDATE user_token SET updated_at = DATETIME('now', 'localtime')
WHERE rowid = NEW.rowid;
END;

 通过触发器 自动更新时间 

 

 SQLite 触发器 | 菜鸟教程 https://www.runoob.com/sqlite/sqlite-trigger.html

 sqlite3自动插入创建时间和更新时间 - wang_yb - 博客园 https://www.cnblogs.com/wang_yb/p/18239784

 

 

 

posted @ 2024-10-09 18:29  papering  阅读(3)  评论(0编辑  收藏  举报