完成除数据查询前端功能的EDataCapture开发
This commit is contained in:
13
app/Init.php
13
app/Init.php
@@ -2,20 +2,21 @@
|
||||
function init_db($server_name, $user, $password) {
|
||||
$dbconn = pg_connect(sprintf("host=%s user=%s password=%s", $server_name, $user, $password));
|
||||
$res = pg_query("select datname from pg_database");
|
||||
if (find_key_value(pg_fetch_assoc($res), 'datname', 'scada'))
|
||||
|
||||
if (!in_array('scada', pg_fetch_all_columns($res, 0)))
|
||||
pg_query("CREATE DATABASE scada");
|
||||
pg_close($dbconn);
|
||||
|
||||
$dbconn = pg_connect(sprintf("host=%s dbname=scada user=%s password=%s", $server_name, $user, $password));
|
||||
pg_query("CREATE TABLE IF NOT EXISTS hf_mes_scada_data_capture_node_configure (
|
||||
id serial2,
|
||||
code text primary key,
|
||||
name text,
|
||||
type text,
|
||||
code text primary key NOT NULL,
|
||||
name text NOT NULL,
|
||||
type text NOT NULL,
|
||||
flow_code text,
|
||||
process_code text,
|
||||
working_subclass text NOT NULL,
|
||||
workstation text,
|
||||
create_date timestamp,
|
||||
create_date timestamp NOT NULL DEFAULT NOW(),
|
||||
note text
|
||||
)");
|
||||
pg_close($dbconn);
|
||||
|
||||
Reference in New Issue
Block a user