Files
workspace/code/app/app-go/db/clothing_add_owner.sql
T
2026-07-03 17:32:11 +08:00

13 lines
567 B
SQL

-- 增量迁移:给衣服和搭配表添加归属者字段
-- 说明:owner_id 引用 b_family_member.user_id;可空;仅为归属标记,
-- 数据仍为家庭共享,不做隔离。
alter table b_clothing_clothes add column if not exists owner_id bigint;
alter table b_clothing_outfit add column if not exists owner_id bigint;
create index if not exists idx_b_clothing_clothes_family_owner
on b_clothing_clothes (family_id, owner_id, id);
create index if not exists idx_b_clothing_outfit_family_owner
on b_clothing_outfit (family_id, owner_id, id);