功能:新增 OSS 备份和交接文档
新增阿里云 OSS 异步备份、重试调度和文件访问签名 URL 回退。 扩展文件存储元数据表结构,并更新作品、店铺、评论、消息和美甲师流程的图片 URL 解析。 新增面向后续 YumiNail 会话的低 token 交接文档。
This commit is contained in:
@@ -276,6 +276,17 @@ create table t_object_storage_file
|
||||
primary key comment '对象存储文件主键索引',
|
||||
file_name varchar(100) not null comment '文件名称',
|
||||
file_url text not null comment '文件访问链接',
|
||||
object_name varchar(512) null comment '对象存储Key',
|
||||
minio_url text null comment 'MinIO访问链接',
|
||||
oss_url text null comment '阿里云OSS内部备份链接',
|
||||
content_type varchar(128) null comment '文件Content-Type',
|
||||
file_size bigint unsigned null comment '文件大小,单位字节',
|
||||
minio_upload_status tinyint unsigned default 0 not null comment 'MinIO上传状态:0-PENDING,1-SUCCEEDED,2-FAILED',
|
||||
oss_upload_status tinyint unsigned default 0 not null comment 'OSS上传状态:0-PENDING,1-SUCCEEDED,2-FAILED',
|
||||
oss_retry_count int unsigned default 0 not null comment 'OSS备份重试次数',
|
||||
oss_last_error varchar(500) null comment '最近一次OSS备份失败原因',
|
||||
oss_uploaded_at datetime null comment 'OSS备份成功时间',
|
||||
oss_last_retry_time datetime null comment '最近一次OSS备份重试时间',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '文件上传时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '文件更新时间',
|
||||
status tinyint unsigned default 1 null comment '文件状态:1-可用,0-不可用,2-回收站',
|
||||
@@ -288,6 +299,10 @@ create index idx_status
|
||||
on t_object_storage_file (status)
|
||||
comment '按文件状态查询的索引';
|
||||
|
||||
create index idx_object_storage_file_oss_retry
|
||||
on t_object_storage_file (oss_upload_status, minio_upload_status, status)
|
||||
comment 'OSS备份失败重试扫描索引';
|
||||
|
||||
-- auto-generated definition
|
||||
create table t_order
|
||||
(
|
||||
@@ -920,6 +935,25 @@ CALL sp_add_column_if_not_exists('t_balance', 'total_recharge_amount', 'decimal(
|
||||
CALL sp_add_column_if_not_exists('t_balance', 'last_recharge_time', 'datetime NULL COMMENT ''最近一次充值时间''');
|
||||
CALL sp_add_column_if_not_exists('t_balance', 'update_time', 'datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ''更新时间''');
|
||||
|
||||
CALL sp_add_column_if_not_exists('t_object_storage_file', 'object_name', 'varchar(512) NULL COMMENT ''对象存储Key''');
|
||||
CALL sp_add_column_if_not_exists('t_object_storage_file', 'minio_url', 'text NULL COMMENT ''MinIO访问链接''');
|
||||
CALL sp_add_column_if_not_exists('t_object_storage_file', 'oss_url', 'text NULL COMMENT ''阿里云OSS内部备份链接''');
|
||||
CALL sp_add_column_if_not_exists('t_object_storage_file', 'content_type', 'varchar(128) NULL COMMENT ''文件Content-Type''');
|
||||
CALL sp_add_column_if_not_exists('t_object_storage_file', 'file_size', 'bigint unsigned NULL COMMENT ''文件大小,单位字节''');
|
||||
CALL sp_add_column_if_not_exists('t_object_storage_file', 'minio_upload_status', 'tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''MinIO上传状态:0-PENDING,1-SUCCEEDED,2-FAILED''');
|
||||
CALL sp_add_column_if_not_exists('t_object_storage_file', 'oss_upload_status', 'tinyint unsigned NOT NULL DEFAULT 0 COMMENT ''OSS上传状态:0-PENDING,1-SUCCEEDED,2-FAILED''');
|
||||
CALL sp_add_column_if_not_exists('t_object_storage_file', 'oss_retry_count', 'int unsigned NOT NULL DEFAULT 0 COMMENT ''OSS备份重试次数''');
|
||||
CALL sp_add_column_if_not_exists('t_object_storage_file', 'oss_last_error', 'varchar(500) NULL COMMENT ''最近一次OSS备份失败原因''');
|
||||
CALL sp_add_column_if_not_exists('t_object_storage_file', 'oss_uploaded_at', 'datetime NULL COMMENT ''OSS备份成功时间''');
|
||||
CALL sp_add_column_if_not_exists('t_object_storage_file', 'oss_last_retry_time', 'datetime NULL COMMENT ''最近一次OSS备份重试时间''');
|
||||
UPDATE t_object_storage_file
|
||||
SET minio_url = COALESCE(minio_url, file_url),
|
||||
minio_upload_status = CASE WHEN minio_upload_status IS NULL OR minio_upload_status = 0 THEN 1 ELSE minio_upload_status END,
|
||||
oss_upload_status = COALESCE(oss_upload_status, 0),
|
||||
oss_retry_count = COALESCE(oss_retry_count, 0)
|
||||
WHERE status = 1;
|
||||
CALL sp_add_index_if_not_exists('t_object_storage_file', 'idx_object_storage_file_oss_retry', '(`oss_upload_status`, `minio_upload_status`, `status`)');
|
||||
|
||||
UPDATE t_balance
|
||||
SET total_recharge_amount = COALESCE(total_recharge_amount, 0.00)
|
||||
WHERE total_recharge_amount IS NULL;
|
||||
|
||||
Reference in New Issue
Block a user