--
-- PostgreSQL database dump
--

\restrict hUde4Y8X2eP1NnPda6s7sFsTAWcc9Q06UxHH57Kk5A7bdw9UPLvvC9NvNSDAd4E

-- Dumped from database version 18.3
-- Dumped by pg_dump version 18.3

-- Started on 2026-03-20 12:47:02

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET transaction_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- TOC entry 222 (class 1259 OID 16610)
-- Name: tb_asset; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.tb_asset (
    asset_id integer NOT NULL,
    project_id integer,
    asset_type character varying(100) NOT NULL,
    asset_code character varying(100) NOT NULL,
    asset_category character varying(50) DEFAULT '整机'::character varying,
    asset_name character varying(255) DEFAULT '未命名设备'::character varying
);


ALTER TABLE public.tb_asset OWNER TO postgres;

--
-- TOC entry 221 (class 1259 OID 16609)
-- Name: tb_asset_asset_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.tb_asset_asset_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.tb_asset_asset_id_seq OWNER TO postgres;

--
-- TOC entry 5064 (class 0 OID 0)
-- Dependencies: 221
-- Name: tb_asset_asset_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.tb_asset_asset_id_seq OWNED BY public.tb_asset.asset_id;


--
-- TOC entry 226 (class 1259 OID 16637)
-- Name: tb_asset_metric_bind; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.tb_asset_metric_bind (
    bind_id integer NOT NULL,
    asset_id integer,
    metric_id integer,
    target_value numeric,
    is_active boolean DEFAULT true
);


ALTER TABLE public.tb_asset_metric_bind OWNER TO postgres;

--
-- TOC entry 225 (class 1259 OID 16636)
-- Name: tb_asset_metric_bind_bind_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.tb_asset_metric_bind_bind_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.tb_asset_metric_bind_bind_id_seq OWNER TO postgres;

--
-- TOC entry 5065 (class 0 OID 0)
-- Dependencies: 225
-- Name: tb_asset_metric_bind_bind_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.tb_asset_metric_bind_bind_id_seq OWNED BY public.tb_asset_metric_bind.bind_id;


--
-- TOC entry 224 (class 1259 OID 16625)
-- Name: tb_metric_dict; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.tb_metric_dict (
    metric_id integer NOT NULL,
    category_level_1 character varying(100),
    metric_name character varying(255) NOT NULL,
    value_type character varying(50) NOT NULL,
    description text
);


ALTER TABLE public.tb_metric_dict OWNER TO postgres;

--
-- TOC entry 223 (class 1259 OID 16624)
-- Name: tb_metric_dict_metric_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.tb_metric_dict_metric_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.tb_metric_dict_metric_id_seq OWNER TO postgres;

--
-- TOC entry 5066 (class 0 OID 0)
-- Dependencies: 223
-- Name: tb_metric_dict_metric_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.tb_metric_dict_metric_id_seq OWNED BY public.tb_metric_dict.metric_id;


--
-- TOC entry 220 (class 1259 OID 16599)
-- Name: tb_project; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.tb_project (
    project_id integer NOT NULL,
    project_name character varying(255) NOT NULL,
    eval_mode character varying(50) NOT NULL,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.tb_project OWNER TO postgres;

--
-- TOC entry 219 (class 1259 OID 16598)
-- Name: tb_project_project_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.tb_project_project_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.tb_project_project_id_seq OWNER TO postgres;

--
-- TOC entry 5067 (class 0 OID 0)
-- Dependencies: 219
-- Name: tb_project_project_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.tb_project_project_id_seq OWNED BY public.tb_project.project_id;


--
-- TOC entry 228 (class 1259 OID 16658)
-- Name: tb_test_record; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.tb_test_record (
    record_id integer NOT NULL,
    asset_id integer,
    metric_id integer,
    test_time timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    raw_data jsonb NOT NULL,
    processed_score numeric,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.tb_test_record OWNER TO postgres;

--
-- TOC entry 227 (class 1259 OID 16657)
-- Name: tb_test_record_record_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.tb_test_record_record_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER SEQUENCE public.tb_test_record_record_id_seq OWNER TO postgres;

--
-- TOC entry 5068 (class 0 OID 0)
-- Dependencies: 227
-- Name: tb_test_record_record_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.tb_test_record_record_id_seq OWNED BY public.tb_test_record.record_id;


--
-- TOC entry 4878 (class 2604 OID 16613)
-- Name: tb_asset asset_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_asset ALTER COLUMN asset_id SET DEFAULT nextval('public.tb_asset_asset_id_seq'::regclass);


--
-- TOC entry 4882 (class 2604 OID 16640)
-- Name: tb_asset_metric_bind bind_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_asset_metric_bind ALTER COLUMN bind_id SET DEFAULT nextval('public.tb_asset_metric_bind_bind_id_seq'::regclass);


--
-- TOC entry 4881 (class 2604 OID 16628)
-- Name: tb_metric_dict metric_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_metric_dict ALTER COLUMN metric_id SET DEFAULT nextval('public.tb_metric_dict_metric_id_seq'::regclass);


--
-- TOC entry 4876 (class 2604 OID 16602)
-- Name: tb_project project_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_project ALTER COLUMN project_id SET DEFAULT nextval('public.tb_project_project_id_seq'::regclass);


--
-- TOC entry 4884 (class 2604 OID 16661)
-- Name: tb_test_record record_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_test_record ALTER COLUMN record_id SET DEFAULT nextval('public.tb_test_record_record_id_seq'::regclass);


--
-- TOC entry 5052 (class 0 OID 16610)
-- Dependencies: 222
-- Data for Name: tb_asset; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.tb_asset (asset_id, project_id, asset_type, asset_code, asset_category, asset_name) FROM stdin;
4	2	数控车床	CNC-001	整机	DVT系列数控车床
5	2	车铣复合中心	CNC-002	整机	DVTM系列车铣复合中心
6	2	电主轴	SP-001	部件	1号主轴
7	2	刀架	RT-001	部件	1号刀架
8	3	时间记录系统测试1	时间记录系统测试1	整机	时间记录系统测试1
9	2	111	11	整机	11
\.


--
-- TOC entry 5056 (class 0 OID 16637)
-- Dependencies: 226
-- Data for Name: tb_asset_metric_bind; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.tb_asset_metric_bind (bind_id, asset_id, metric_id, target_value, is_active) FROM stdin;
14	5	1	\N	t
15	6	10	\N	t
16	6	9	\N	t
17	7	2	\N	t
18	8	6	\N	t
19	8	5	\N	t
25	9	10	\N	t
26	9	13	\N	t
27	9	14	\N	t
28	4	11	\N	t
29	4	3	\N	t
30	4	7	\N	t
31	4	8	\N	t
32	4	5	\N	t
\.


--
-- TOC entry 5054 (class 0 OID 16625)
-- Dependencies: 224
-- Data for Name: tb_metric_dict; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.tb_metric_dict (metric_id, category_level_1, metric_name, value_type, description) FROM stdin;
1	几何精度	线性运动的直线度	单值	标准为0.05-0.1
3	加工精度	被加工件尺寸精度	抽样数组	
2	部件专属	X轴振动	单值	修改测试
5	几何精度	线性运动的角度偏差	单值	
6	几何精度	线性运动的垂直度	单值	
8	位置精度	重复定位精度	单值	
9	部件专属	Y轴振动	单值	
10	部件专属	Z轴振动	单值	
11	加工精度	被加工件几何精度	单值	
12	加工精度	被加工件表面精度	单值	
7	几何精度	回转轴端面径向跳动	单值	
13	几何精度	用于删除演示	单值	
14	部件专属	111	单值	
\.


--
-- TOC entry 5050 (class 0 OID 16599)
-- Dependencies: 220
-- Data for Name: tb_project; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.tb_project (project_id, project_name, eval_mode, created_at) FROM stdin;
2	XX实验项目	整机跟踪,部件模拟	2026-03-03 22:44:19.633716
3	合作项目A	整机跟踪	2026-03-03 22:44:32.119409
4	公司长期跟踪项目A	整机跟踪	2026-03-04 01:34:09.558863
6	26项目	部件模拟,整机跟踪	2026-03-06 13:28:33.144395
\.


--
-- TOC entry 5058 (class 0 OID 16658)
-- Dependencies: 228
-- Data for Name: tb_test_record; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.tb_test_record (record_id, asset_id, metric_id, test_time, raw_data, processed_score, created_at) FROM stdin;
4	4	1	2026-03-04 02:54:44.059045	{"val": 2}	\N	2026-03-04 22:29:18.844828
5	4	3	2026-03-04 02:54:44.059045	{"samples": [1, 2, 3, 3, 2, 3]}	\N	2026-03-04 22:29:18.844828
6	4	8	2026-03-04 02:54:44.059045	{"val": 1}	\N	2026-03-04 22:29:18.844828
7	4	11	2026-03-04 02:54:44.059045	{"val": 1}	\N	2026-03-04 22:29:18.844828
8	4	7	2026-03-04 02:54:44.059045	{"val": 1}	\N	2026-03-04 22:29:18.844828
9	4	1	2026-03-04 20:18:57.533805	{"val": 1}	\N	2026-03-04 22:29:18.844828
10	4	3	2026-03-04 20:18:57.533805	{"samples": [1]}	\N	2026-03-04 22:29:18.844828
11	4	8	2026-03-04 20:18:57.533805	{"val": 1}	\N	2026-03-04 22:29:18.844828
12	4	11	2026-03-04 20:18:57.533805	{"val": 1}	\N	2026-03-04 22:29:18.844828
13	4	7	2026-03-04 20:18:57.533805	{"val": 1}	\N	2026-03-04 22:29:18.844828
15	8	6	2026-03-04 23:20:47.271075	{"val": 1}	\N	2026-03-04 23:20:47.271075
16	4	3	2026-03-06 13:33:16.75924	{"samples": [1, 23, 32]}	\N	2026-03-06 13:33:16.75924
17	4	5	2026-03-06 13:33:16.75924	{"val": 1}	\N	2026-03-06 13:33:16.75924
18	4	8	2026-03-06 13:33:16.75924	{"val": 2}	\N	2026-03-06 13:33:16.75924
19	4	11	2026-03-06 13:33:16.75924	{"val": 3}	\N	2026-03-06 13:33:16.75924
20	4	7	2026-03-06 13:33:16.75924	{"val": 4}	\N	2026-03-06 13:33:16.75924
21	8	5	2026-03-06 13:34:21.340412	{"val": 1111}	\N	2026-03-06 13:34:21.340412
22	8	6	2026-03-06 13:34:21.340412	{"val": 11111}	\N	2026-03-06 13:34:21.340412
\.


--
-- TOC entry 5069 (class 0 OID 0)
-- Dependencies: 221
-- Name: tb_asset_asset_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.tb_asset_asset_id_seq', 9, true);


--
-- TOC entry 5070 (class 0 OID 0)
-- Dependencies: 225
-- Name: tb_asset_metric_bind_bind_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.tb_asset_metric_bind_bind_id_seq', 32, true);


--
-- TOC entry 5071 (class 0 OID 0)
-- Dependencies: 223
-- Name: tb_metric_dict_metric_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.tb_metric_dict_metric_id_seq', 14, true);


--
-- TOC entry 5072 (class 0 OID 0)
-- Dependencies: 219
-- Name: tb_project_project_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.tb_project_project_id_seq', 6, true);


--
-- TOC entry 5073 (class 0 OID 0)
-- Dependencies: 227
-- Name: tb_test_record_record_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.tb_test_record_record_id_seq', 22, true);


--
-- TOC entry 4894 (class 2606 OID 16646)
-- Name: tb_asset_metric_bind tb_asset_metric_bind_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_asset_metric_bind
    ADD CONSTRAINT tb_asset_metric_bind_pkey PRIMARY KEY (bind_id);


--
-- TOC entry 4890 (class 2606 OID 16618)
-- Name: tb_asset tb_asset_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_asset
    ADD CONSTRAINT tb_asset_pkey PRIMARY KEY (asset_id);


--
-- TOC entry 4892 (class 2606 OID 16635)
-- Name: tb_metric_dict tb_metric_dict_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_metric_dict
    ADD CONSTRAINT tb_metric_dict_pkey PRIMARY KEY (metric_id);


--
-- TOC entry 4888 (class 2606 OID 16608)
-- Name: tb_project tb_project_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_project
    ADD CONSTRAINT tb_project_pkey PRIMARY KEY (project_id);


--
-- TOC entry 4896 (class 2606 OID 16668)
-- Name: tb_test_record tb_test_record_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_test_record
    ADD CONSTRAINT tb_test_record_pkey PRIMARY KEY (record_id);


--
-- TOC entry 4898 (class 2606 OID 16647)
-- Name: tb_asset_metric_bind tb_asset_metric_bind_asset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_asset_metric_bind
    ADD CONSTRAINT tb_asset_metric_bind_asset_id_fkey FOREIGN KEY (asset_id) REFERENCES public.tb_asset(asset_id) ON DELETE CASCADE;


--
-- TOC entry 4899 (class 2606 OID 16652)
-- Name: tb_asset_metric_bind tb_asset_metric_bind_metric_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_asset_metric_bind
    ADD CONSTRAINT tb_asset_metric_bind_metric_id_fkey FOREIGN KEY (metric_id) REFERENCES public.tb_metric_dict(metric_id) ON DELETE CASCADE;


--
-- TOC entry 4897 (class 2606 OID 16619)
-- Name: tb_asset tb_asset_project_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_asset
    ADD CONSTRAINT tb_asset_project_id_fkey FOREIGN KEY (project_id) REFERENCES public.tb_project(project_id) ON DELETE CASCADE;


--
-- TOC entry 4900 (class 2606 OID 16669)
-- Name: tb_test_record tb_test_record_asset_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_test_record
    ADD CONSTRAINT tb_test_record_asset_id_fkey FOREIGN KEY (asset_id) REFERENCES public.tb_asset(asset_id) ON DELETE CASCADE;


--
-- TOC entry 4901 (class 2606 OID 16674)
-- Name: tb_test_record tb_test_record_metric_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.tb_test_record
    ADD CONSTRAINT tb_test_record_metric_id_fkey FOREIGN KEY (metric_id) REFERENCES public.tb_metric_dict(metric_id) ON DELETE CASCADE;


-- Completed on 2026-03-20 12:47:02

--
-- PostgreSQL database dump complete
--

\unrestrict hUde4Y8X2eP1NnPda6s7sFsTAWcc9Q06UxHH57Kk5A7bdw9UPLvvC9NvNSDAd4E

