feat(db): add channel event record idempotency table
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.sino.mci.channel.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("mci_channel_event_record")
|
||||
public class ChannelEventRecord {
|
||||
|
||||
@TableId(type = IdType.INPUT)
|
||||
private String eventId;
|
||||
|
||||
private String accountId;
|
||||
|
||||
private String eventType;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.sino.mci.channel.repository;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sino.mci.channel.entity.ChannelEventRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ChannelEventRecordMapper extends BaseMapper<ChannelEventRecord> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
CREATE TABLE IF NOT EXISTS mci_channel_event_record (
|
||||
event_id VARCHAR(64) PRIMARY KEY,
|
||||
account_id VARCHAR(64) NOT NULL,
|
||||
event_type VARCHAR(32) NOT NULL,
|
||||
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE INDEX idx_channel_event_account_time ON mci_channel_event_record(account_id, create_time);
|
||||
Reference in New Issue
Block a user