Files
backend_v2/db/migrations/2026-10-25-03-menswear-season-code.sql
toom1996 d6ed96624a fix: 男装季节码不再一律 FW + 本地图迁移到 S4 的工具
男装季节码
- prefixOf 里 menswear 原来直接 return "FW",导致同年 Spring/Fall 男装推出同一个
  season_code(如 Spring 2021 与 Fall 2021 都是 FW21)。实体键是
  (brand + season_code + collection_type),后到的那场被判「已存在」静默丢弃。
- 改为按真实季节:春男装 SSyy、秋男装 FWyy。
- 迁移 2026-10-25-03 把历史「Spring ... Menswear」行的 season_code 由 FWyy 改写为 SSyy;
  实测无唯一键冲突(同品牌春夏男装此前必然因撞键未入库)。

s4migrate
- 新增 cmd/s4migrate:把库里 /uploads/... 的历史图片按内容寻址 key 上传到 S4,
  并改写图片行与封面,之后全站只保留 S4 一种存储(不再依赖 nginx 转发 /uploads)。
- 实测:136 张全部迁移成功,库内 /uploads 残留 0。
2026-10-25 14:55:30 +08:00

16 lines
911 B
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.

-- 修正男装的 season_code:春/夏男装应为 SSyy,秋/冬男装为 FWyy。
--
-- 原实现里 menswear 一律返回 FW,于是同年的 Spring/Fall 男装共用 FWyy,
-- 而实体键是(brand_id + season_code + collection_type)→ 后到的一场被判「已存在」跳过。
-- 实测 AMBUSH:Vogue 25 场,入库 21 场,缺的 4 场全是男装。
--
-- 只改「春夏男装」(标题以 Spring 开头)的历史行;秋冬男装本来就是 FWyy,保持不变。
-- 安全性:同一品牌的春夏男装此前必然与秋冬男装撞键而未入库,
-- 因此改成 SSyy 不会与现有行冲突(唯一索引 (brand_id, season_code, collection_type))。
UPDATE brand_runways
SET season_code = 'SS' || right(year::text, 2)
WHERE collection_type = 'menswear'
AND season_code LIKE 'FW%'
AND year >= 2000
AND (title_en LIKE 'Spring%' OR title_en LIKE 'Resort%');