20260706170339

This commit is contained in:
oneao committed 2026-07-06 17:03:39 +08:00
1 parent ae99f50f6d
commit 4d1e6c8b8f
50 files changed
+3045 -2249

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
drop table if exists b_anniversary;
create table b_anniversary (
id bigint primary key,
family_id bigint not null,
name varchar(64) not null,
month smallint not null,
day smallint not null,
type smallint not null default 0,
remind_before smallint default 0,
sort_number int not null default 0,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
create index idx_b_anniversary_family on b_anniversary (family_id);
+38 -21
View File
@@ -1,4 +1,5 @@
drop table if exists b_clothing_tag_relation;
drop table if exists b_clothing_clothes_tag;
drop table if exists b_clothing_outfit_tag;
drop table if exists b_clothing_outfit_clothes;
drop table if exists b_clothing_tag;
drop table if exists b_clothing_category;
@@ -16,8 +17,8 @@ create table b_clothing_clothes (
remark varchar(512) default '',
sort_number int not null default 0,
status smallint not null default 1,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -33,8 +34,8 @@ create table b_clothing_outfit (
remark varchar(512) default '',
sort_number int not null default 0,
status smallint not null default 1,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -50,8 +51,8 @@ create table b_clothing_outfit_clothes (
height numeric(8, 6) not null default 0,
z_index int not null default 0,
sort_number int not null default 0,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -63,8 +64,8 @@ create table b_clothing_category (
type smallint not null,
sort_number int not null default 0,
status smallint not null default 1,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -72,26 +73,36 @@ create table b_clothing_category (
create table b_clothing_tag (
id bigint primary key,
family_id bigint not null,
parent_id bigint not null default 0,
parent_id bigint,
name varchar(32) not null,
type smallint not null,
color varchar(7) default '',
sort_number int not null default 0,
status smallint not null default 1,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
create table b_clothing_tag_relation (
create table b_clothing_clothes_tag (
id bigint primary key,
family_id bigint not null,
target_type smallint not null,
target_id bigint not null,
clothes_id bigint not null,
tag_id bigint not null,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
create table b_clothing_outfit_tag (
id bigint primary key,
family_id bigint not null,
outfit_id bigint not null,
tag_id bigint not null,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -120,8 +131,14 @@ create index idx_b_clothing_category_family_type
create index idx_b_clothing_tag_family_parent
on b_clothing_tag (family_id, status, type, parent_id, sort_number, id);
create index idx_b_clothing_tag_relation_target
on b_clothing_tag_relation (family_id, target_type, target_id, tag_id);
create index idx_b_clothing_clothes_tag_clothes
on b_clothing_clothes_tag (family_id, clothes_id, tag_id);
create index idx_b_clothing_tag_relation_tag
on b_clothing_tag_relation (family_id, tag_id, target_type, target_id);
create index idx_b_clothing_clothes_tag_tag
on b_clothing_clothes_tag (family_id, tag_id, clothes_id);
create index idx_b_clothing_outfit_tag_outfit
on b_clothing_outfit_tag (family_id, outfit_id, tag_id);
create index idx_b_clothing_outfit_tag_tag
on b_clothing_outfit_tag (family_id, tag_id, outfit_id);
+20
View File
@@ -0,0 +1,20 @@
drop table if exists b_finance_auto;
create table b_finance_auto (
id bigint primary key,
family_id bigint not null,
type smallint not null,
category_id bigint not null,
amount numeric(12,2) not null,
remark varchar(255) default '',
repeat_type smallint not null,
repeat_date varchar(64) default '',
last_run date,
status smallint not null default 1,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
create index idx_b_finance_auto_family on b_finance_auto (family_id, status);
+4 -4
View File
@@ -8,8 +8,8 @@ create table b_finance_category_default (
icon_file_key varchar(512) not null,
sort_number int not null default 0,
status smallint not null default 1,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -23,8 +23,8 @@ create table b_finance_category (
icon_source smallint not null,
sort_number int not null default 0,
status smallint not null default 1,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
+20 -20
View File
@@ -28,8 +28,8 @@ create table b_meal_dish (
remark varchar(512) default '',
status smallint not null default 1,
sort_number int not null default 0,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -43,8 +43,8 @@ create table b_meal_category (
name varchar(32) not null,
sort_number int not null default 0,
status smallint not null default 1,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -61,8 +61,8 @@ create table b_meal_tag (
color varchar(7) default '',
sort_number int not null default 0,
status smallint not null default 1,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -80,8 +80,8 @@ create table b_meal_dish_ingredient (
spec varchar(64) default '',
remark varchar(128) default '',
sort_number int not null default 0,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -97,8 +97,8 @@ create table b_meal_dish_step (
description varchar(1024) default '',
image_file_key varchar(512) default '',
sort_number int not null default 0,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -111,8 +111,8 @@ create table b_meal_dish_tag (
family_id bigint not null,
dish_id bigint not null,
tag_id bigint not null,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -126,8 +126,8 @@ create table b_meal_slot (
name varchar(32) not null,
sort_number int not null default 0,
status smallint not null default 1,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -145,8 +145,8 @@ create table b_meal_plan (
status smallint not null default 0,
remark varchar(512) default '',
cook_by bigint,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -162,8 +162,8 @@ create table b_meal_plan_item (
quantity int not null default 1,
remark varchar(256) default '',
sort_number int not null default 0,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
@@ -181,8 +181,8 @@ create table b_meal_plan_log (
content varchar(1024) default '',
ref_id bigint,
dish_name varchar(128) default null,
create_time timestamp,
update_time timestamp,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
+84
View File
@@ -0,0 +1,84 @@
drop table if exists b_todo_file;
drop table if exists b_todo_rating;
drop table if exists b_todo_log;
drop table if exists b_todo;
-- 待办
create table b_todo (
id bigint primary key,
family_id bigint not null,
name varchar(64) not null,
description varchar(512) default '',
status smallint not null default 0,
priority smallint not null default 0,
assignee_id bigint,
deadline timestamptz,
completed_at timestamptz,
repeat_type smallint not null default 0,
remind_at timestamptz,
complete_note varchar(512) default '',
sort_number int not null default 0,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
-- 日志
create table b_todo_log (
id bigint primary key,
family_id bigint not null,
todo_id bigint not null,
type smallint not null,
content varchar(1024) default '',
ref_id bigint,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
-- 评分
create table b_todo_rating (
id bigint primary key,
family_id bigint not null,
todo_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
);
-- 附件(完成时上传的图片/视频等)
create table b_todo_file (
id bigint primary key,
family_id bigint not null,
todo_log_id bigint not null,
todo_id bigint not null,
file_key varchar(256) not null,
file_name varchar(256),
file_type smallint default 1,
mime_type varchar(64),
file_size bigint,
width int,
height int,
duration int,
sort_order int not null default 0,
create_time timestamptz,
update_time timestamptz,
create_by bigint,
update_by bigint
);
-- 索引
create index idx_b_todo_family_status on b_todo (family_id, status, sort_number, id);
create index idx_b_todo_family_assignee on b_todo (family_id, assignee_id, status);
create index idx_b_todo_log_todo on b_todo_log (family_id, todo_id, create_time, id);
create unique index idx_b_todo_log_todo_type_ref on b_todo_log (family_id, todo_id, type, ref_id);
create index idx_b_todo_rating_todo on b_todo_rating (family_id, todo_id, id);
create unique index idx_b_todo_rating_todo_rater on b_todo_rating (family_id, todo_id, rater_id);
create index idx_b_todo_file_todo_log on b_todo_file (family_id, todo_log_id, sort_order);
create index idx_b_todo_file_todo on b_todo_file (family_id, todo_id, id);