20260706213434
This commit is contained in:
1 parent
4d1e6c8b8f
commit
f8e16efa83
23 files changed
+1232
-765
No files matched your search
@@ -2,6 +2,7 @@
|
||||
-- 餐食模块 数据库表结构
|
||||
-- ============================================================
|
||||
|
||||
drop table if exists b_meal_plan_rating;
|
||||
drop table if exists b_meal_dish_tag;
|
||||
drop table if exists b_meal_dish_ingredient;
|
||||
drop table if exists b_meal_dish_step;
|
||||
@@ -187,6 +188,24 @@ create table b_meal_plan_log (
|
||||
update_by bigint
|
||||
);
|
||||
|
||||
-- ============================================================
|
||||
-- 餐食安排评分
|
||||
-- rating: 1-5 星
|
||||
-- 同一家庭、同一安排、同一评分人只有一条记录(通过索引保证唯一)
|
||||
-- ============================================================
|
||||
create table b_meal_plan_rating (
|
||||
id bigint primary key,
|
||||
family_id bigint not null,
|
||||
plan_id bigint not null,
|
||||
rater_id bigint not null,
|
||||
rating smallint not null,
|
||||
content varchar(256) default '',
|
||||
create_time timestamptz,
|
||||
update_time timestamptz,
|
||||
create_by bigint,
|
||||
update_by bigint
|
||||
);
|
||||
|
||||
-- ============================================================
|
||||
-- 索引
|
||||
-- ============================================================
|
||||
@@ -245,3 +264,11 @@ create index idx_b_meal_plan_log_plan
|
||||
-- 活动日志:按安排和类型筛选
|
||||
create index idx_b_meal_plan_log_plan_type
|
||||
on b_meal_plan_log (family_id, plan_id, type);
|
||||
|
||||
-- 评分:按安排查询
|
||||
create index idx_b_meal_plan_rating_plan
|
||||
on b_meal_plan_rating (family_id, plan_id, id);
|
||||
|
||||
-- 评分:同一家庭、同一安排、同一评分人唯一
|
||||
create unique index idx_b_meal_plan_rating_plan_rater
|
||||
on b_meal_plan_rating (family_id, plan_id, rater_id);
|
||||
Reference in new issue
Block a user