最近重构项目中,涉及到表结构变更, 需要对原来的数据做代码层面的双向更新,保证数据一致性。发现mysql中有REPLACE 函数

REPLACE INTO coupon_test.w_user_coupon_use_record( id,user_id_code, user_coupon_id, order_sn, coupon_type, order_id, status, rule_config, biz_code, created_time, updated_time, deleted_time) VALUES (29, 2594277, 17191161, '160576703474599524277', 6, 0, 1, '[{"amount":100,"discount":0.0,"level":1,"promotionId":1010335,"step":1},{"amount":100,"discount":0.0,"level":2,"promotionId":1010335,"step":1},{"amount":100,"discount":0.0,"level":3,"promotionId":1010335,"step":1},{"amount":100,"discount":0.0,"level":4,"promotionId":1010335,"step":1},{"amount":100,"discount":0.0,"level":5,"promotionId":1010335,"step":1}]', '', '2020-11-19 14:23:56', '2021-01-23 11:48:59', NULL);

posted on 2021-07-07 16:30  爱不死  阅读(197)  评论(0编辑  收藏  举报