v3数据表更改
This commit is contained in:
@@ -266,7 +266,10 @@ DROP TABLE IF EXISTS user_user;
|
||||
CREATE TABLE user_user (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
user_no VARCHAR(20) NOT NULL,
|
||||
phone VARCHAR(20) NOT NULL,
|
||||
device_key VARCHAR(36) DEFAULT NULL COMMENT '访客设备标识',
|
||||
phone VARCHAR(20) DEFAULT NULL COMMENT '验机后必填;访客可为NULL',
|
||||
phone_verified_at DATETIME(3) DEFAULT NULL,
|
||||
merged_into_user_id BIGINT UNSIGNED DEFAULT NULL COMMENT '合并入主账号',
|
||||
wx_open_id VARCHAR(64) DEFAULT NULL,
|
||||
wx_union_id VARCHAR(64) DEFAULT NULL,
|
||||
nickname VARCHAR(64) DEFAULT NULL,
|
||||
@@ -281,8 +284,10 @@ CREATE TABLE user_user (
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_user_user_phone (phone),
|
||||
UNIQUE KEY uk_user_user_no (user_no),
|
||||
UNIQUE KEY uk_user_user_device_key (device_key),
|
||||
KEY idx_user_user_source (source_type, source_ref_id),
|
||||
KEY idx_user_user_referrer (referrer_user_id),
|
||||
KEY idx_user_user_merged (merged_into_user_id),
|
||||
KEY idx_user_user_wx_open (wx_open_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='C端用户';
|
||||
|
||||
@@ -426,6 +431,16 @@ CREATE TABLE user_order (
|
||||
receiver_province VARCHAR(32) NOT NULL,
|
||||
receiver_city VARCHAR(32) NOT NULL,
|
||||
receiver_district VARCHAR(32) NOT NULL,
|
||||
client_ip VARCHAR(45) DEFAULT NULL COMMENT '下单时客户端IP',
|
||||
ip_province VARCHAR(32) DEFAULT NULL COMMENT 'IP解析省',
|
||||
ip_city VARCHAR(32) DEFAULT NULL COMMENT 'IP解析市',
|
||||
ip_district VARCHAR(32) DEFAULT NULL COMMENT 'IP解析区县',
|
||||
gps_province VARCHAR(32) DEFAULT NULL COMMENT 'GPS解析省',
|
||||
gps_city VARCHAR(32) DEFAULT NULL COMMENT 'GPS解析市',
|
||||
gps_district VARCHAR(32) DEFAULT NULL COMMENT 'GPS解析区县',
|
||||
gps_latitude DECIMAL(10,7) DEFAULT NULL,
|
||||
gps_longitude DECIMAL(10,7) DEFAULT NULL,
|
||||
gps_address VARCHAR(256) DEFAULT NULL COMMENT 'GPS逆地理地址',
|
||||
pay_external_no VARCHAR(64) DEFAULT NULL COMMENT '微信交易号(冗余)',
|
||||
paid_at DATETIME(3) DEFAULT NULL COMMENT '支付时间',
|
||||
shipped_at DATETIME(3) DEFAULT NULL COMMENT '发货时间(冗余=user_order_delivery.shipping_at)',
|
||||
@@ -442,6 +457,8 @@ CREATE TABLE user_order (
|
||||
KEY idx_user_order_product (product_id),
|
||||
KEY idx_user_order_barcode (barcode_69),
|
||||
KEY idx_user_order_pay_external (pay_external_no),
|
||||
KEY idx_user_order_ip_city (ip_city),
|
||||
KEY idx_user_order_gps_city (gps_city),
|
||||
CONSTRAINT fk_user_order_user FOREIGN KEY (user_id) REFERENCES user_user(id) ON DELETE RESTRICT,
|
||||
CONSTRAINT fk_user_order_city FOREIGN KEY (city_id) REFERENCES common_city(id) ON DELETE RESTRICT,
|
||||
CONSTRAINT fk_user_order_origin FOREIGN KEY (origin_order_id) REFERENCES user_order(id) ON DELETE SET NULL,
|
||||
|
||||
Reference in New Issue
Block a user