数据库为node配置增加一个enum类型,暂时不增加相关业务逻辑

This commit is contained in:
Yu Sun
2022-08-20 14:19:12 +08:00
parent a948c11eb9
commit ede4c9160d

View File

@@ -10,11 +10,17 @@ function init_db($server_name, $port, $user, $password) {
$dbconn = pg_connect(sprintf("host=%s port=%s dbname=scada user=%s password=%s", $server_name, $port, $user, $password)); $dbconn = pg_connect(sprintf("host=%s port=%s dbname=scada user=%s password=%s", $server_name, $port, $user, $password));
// 全局未启用TSDB的时候在这里对scada数据库启用就好 // 全局未启用TSDB的时候在这里对scada数据库启用就好
pg_query($dbconn, "CREATE EXTENSION IF NOT EXISTS timescaledb"); pg_query($dbconn, "CREATE EXTENSION IF NOT EXISTS timescaledb");
pg_query(
$dbconn,
"CREATE TYPE category
AS ENUM ('DEVICE_STATUS', 'ITEM_ID', 'DEVICE_DATA', 'PROCESS_DATA', 'RESULT_DATA', 'STATISTICAL_DATA')"
);
pg_query($dbconn, "CREATE TABLE IF NOT EXISTS hf_mes_scada_data_capture_node_configure ( pg_query($dbconn, "CREATE TABLE IF NOT EXISTS hf_mes_scada_data_capture_node_configure (
id serial2 primary key, id serial2 primary key,
code text, code text,
name text NOT NULL, name text NOT NULL,
type text NOT NULL, type text NOT NULL,
category category,
flow_code text, flow_code text,
working_subclass text NOT NULL, working_subclass text NOT NULL,
workstation text, workstation text,