fix(db): 统一字符集排序规则并修复时间戳类型

- 新增 SQL 脚本统一表与列字符集为 utf8mb4_unicode_ci
- 移除建表语句冗余 COLLATE 子句,由全局配置控制
- 将挑战起止时间字段由 Date 改为 BIGINT 时间戳,避免时区与精度问题
- 补充 Winston 日志追踪挑战详情查询性能
- 数据库模块新增 charset 与 collate 全局配置,确保后续表一致性

BREAKING CHANGE: challenge.startAt/endAt 由 Date 变更为 number(毫秒时间戳),调用方需同步调整类型
This commit is contained in:
richarjiang
2025-09-29 09:59:06 +08:00
parent ae8039c9ed
commit 22fcf694a6
6 changed files with 92 additions and 13 deletions

View File

@@ -34,18 +34,18 @@ export class Challenge extends Model {
declare image: string;
@Column({
type: DataType.DATE,
type: DataType.BIGINT,
allowNull: false,
comment: '挑战开始时间',
comment: '挑战开始时间(时间戳)',
})
declare startAt: Date;
declare startAt: number;
@Column({
type: DataType.DATE,
type: DataType.BIGINT,
allowNull: false,
comment: '挑战结束时间',
comment: '挑战结束时间(时间戳)',
})
declare endAt: Date;
declare endAt: number;
@Column({
type: DataType.STRING(128),