refactor(db): align project template schema
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
-- [USERS]
|
||||
-- 王名豪
|
||||
-- 2025/03/23
|
||||
-- 存储系统的用户信息,如用户名,密码
|
||||
|
||||
create table users (
|
||||
user_id SERIAL PRIMARY KEY,
|
||||
username varchar(32) not null unique,
|
||||
password varchar(32) not null
|
||||
)
|
||||
@@ -7,7 +7,7 @@ create table scheme_list (
|
||||
scheme_id SERIAL PRIMARY KEY,
|
||||
scheme_name varchar(32) not null,
|
||||
scheme_type varchar(32) not null,
|
||||
username varchar(32) not null REFERENCES "users"(username) ON UPDATE CASCADE ON DELETE RESTRICT,
|
||||
username varchar(32) not null,
|
||||
create_time TIMESTAMP WITH TIME ZONE not null DEFAULT date_trunc('minute', CURRENT_TIMESTAMP),
|
||||
scheme_start_time TIMESTAMP WITH TIME ZONE not null,
|
||||
scheme_detail JSON
|
||||
|
||||
@@ -8,7 +8,7 @@ CREATE TABLE sensor_placement (
|
||||
scheme_name varchar(32) not null,
|
||||
sensor_number int,
|
||||
min_diameter int,
|
||||
username varchar(32) not null REFERENCES "users"(username) ON UPDATE CASCADE ON DELETE RESTRICT,
|
||||
username varchar(32) not null,
|
||||
create_time TIMESTAMP WITH TIME ZONE not null DEFAULT date_trunc('minute', CURRENT_TIMESTAMP),
|
||||
sensor_location TEXT[]
|
||||
);
|
||||
);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
-- [LEAKAGE_IDENTIFY_RESULT]
|
||||
-- 存储漏损识别任务的结果数据。
|
||||
|
||||
CREATE TABLE leakage_identify_result (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
scheme_name varchar NOT NULL,
|
||||
network varchar NOT NULL,
|
||||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
|
||||
run_status varchar NOT NULL DEFAULT 'completed',
|
||||
error_message text,
|
||||
sensor_nodes jsonb NOT NULL DEFAULT '[]'::jsonb,
|
||||
result_rows jsonb NOT NULL DEFAULT '[]'::jsonb,
|
||||
node_area_map jsonb NOT NULL DEFAULT '{}'::jsonb,
|
||||
areas jsonb DEFAULT '[]'::jsonb,
|
||||
drawing_payload jsonb DEFAULT '{"type": "FeatureCollection", "features": []}'::jsonb,
|
||||
CONSTRAINT uq_leakage_identify_result_scheme UNIQUE (scheme_name)
|
||||
);
|
||||
Reference in New Issue
Block a user