新建等级表
1 | drop table if exists `rank`; |
插入数据
1 | insert into rank (rank,name,score) values (1,'等级1',0); |
重写trigger
1 | drop trigger if exists `insert_user_event`; |
运行
1 | update user set rank = 0 , score = 0 where id = 1; |
运行后,用户rank=1 score=501
1 | drop table if exists `rank`; |
1 | insert into rank (rank,name,score) values (1,'等级1',0); |
1 | drop trigger if exists `insert_user_event`; |
1 | update user set rank = 0 , score = 0 where id = 1; |
运行后,用户rank=1 score=501