Files
dpb/backend/sql/weld_combining_index_kinship.sql
T
34047007@qq.com b95053c52c init: 初始化 dpb 桃育种系统代码库
前后端 + 后端 FastAPI 全量源码、部署脚本与文档。
2026-08-06 00:17:49 +08:00

29 lines
1.7 KiB
SQL

-- 断链焊接(第二段):配合力纯Python化 / 选择指数落库 / 亲缘近交分析
-- 新增 bre_selection_index 表(create_all 只建新表,已有库需手动执行本脚本)。
-- 依赖:bre_selection_result 表已存在(决选写入);bre_germplasm/bre_tree 已存在。
CREATE TABLE IF NOT EXISTS bre_selection_index (
id integer GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
model_name varchar(128),
method varchar(16),
weights_json jsonb,
batch_refs_json jsonb,
heritability_json jsonb,
top_n integer,
result_json jsonb,
created_time timestamp with time zone NOT NULL DEFAULT now(),
updated_time timestamp with time zone,
is_deleted boolean NOT NULL DEFAULT false,
deleted_time timestamp with time zone,
created_id integer REFERENCES sys_user(id) ON UPDATE CASCADE ON DELETE SET NULL,
updated_id integer REFERENCES sys_user(id) ON UPDATE CASCADE ON DELETE SET NULL,
deleted_id integer REFERENCES sys_user(id) ON UPDATE CASCADE ON DELETE SET NULL,
uuid varchar(64) NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS ix_bre_selection_index_uuid ON bre_selection_index (uuid);
CREATE INDEX IF NOT EXISTS ix_bre_selection_index_created_deleted ON bre_selection_index (created_time, is_deleted);
CREATE INDEX IF NOT EXISTS ix_bre_selection_index_created_id ON bre_selection_index (created_id);
CREATE INDEX IF NOT EXISTS ix_bre_selection_index_updated_id ON bre_selection_index (updated_id);
CREATE INDEX IF NOT EXISTS ix_bre_selection_index_deleted_id ON bre_selection_index (deleted_id);