wz-golang-server/docs/sql/mysql/t_platform_user.sql

16 lines
1.3 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE TABLE t_platform_user (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '平台用户ID自增',
user_id BIGINT NOT NULL COMMENT '关联t_user.id',
platform_type TINYINT NOT NULL COMMENT '平台类型1-微信小程序2-抖音小程序3-支付宝小程序',
platform_openid VARCHAR(100) NOT NULL COMMENT '平台唯一标识微信openid/抖音open_id',
platform_unionid VARCHAR(100) COMMENT '平台统一标识微信unionid多小程序互通用',
platform_session_key VARCHAR(100) COMMENT '平台会话密钥微信session_key加密存储',
platform_extra JSON COMMENT '平台扩展字段如抖音的user_name、微信的city等',
last_login_time TIMESTAMP NULL COMMENT '最后登录时间',
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
deleted TINYINT DEFAULT 0 COMMENT '软删除0-未删1-已删',
UNIQUE KEY uk_platform_openid (platform_type, platform_openid),
CONSTRAINT fk_platform_user_user_id FOREIGN KEY (user_id) REFERENCES t_user(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='平台用户关联表(微信/抖音小程序用户信息)';