mysql 触发器相关
chat_content聊天记录
chat_content_id所属id号int(11)非空主键自增长
from_id发送方idint(11)非空
to_id接收方idint(11)非空
content聊天数据text默认null
chat_time发送时间 datetime可空由触发器更新
建表:
create table chat_content( chat_content_id int(11) not null AUTO_INCREMENT, from_id int(11) not null, to_id int(11) not null, content text default NULL, chat_time datetime, primary key (chat_content_id),}
/*==============================================================*//* TRIGGER: chat_content_trig chat_content insert用 *//*==============================================================*/CREATE TRIGGER chat_content_trig after insertON chat_content FOR EACH ROW BEGIN update chat_content set chat_time =(select sysdate()) where chat_content_id=new.chat_content_idEND;