DROP
DATABASE IF EXISTS iot_data;
CREATE DATABASE iot_data KEEP 3650 DURATION 10 WAL_LEVEL 1;
CREATE TABLE IF NOT EXISTS iot_data.super_state (ts TIMESTAMP, value_collect TINYINT, calendar_code NCHAR(128), factory_year INT, factory_month TINYINT, factory_week INT, factory_date INT, shift_index TINYINT, shift_time_type TINYINT, wcs TINYINT, rps TINYINT, is_fix_point BOOL, is_sync BOOL, is_plan TINYINT, feedback_point_type TINYINT, feedback_id BIGINT, is_deleted BOOL, employee_id BIGINT) TAGS (workstation_id BIGINT);
CREATE TABLE IF NOT EXISTS iot_data.super_output (ts TIMESTAMP, value_collect BIGINT, param_type INT, calendar_code NCHAR(128), factory_year INT, factory_month TINYINT, factory_week INT, factory_date INT, shift_index TINYINT, shift_time_type TINYINT, program NCHAR(128), product_code NCHAR(128), product_name NCHAR(128), is_sync BOOL, employee_id BIGINT) TAGS (workstation_id BIGINT);
CREATE TABLE IF NOT EXISTS iot_data.super_alarm
(
ts
TIMESTAMP,
calendar_code
NCHAR(128),
factory_year INT,
factory_month TINYINT,
factory_week INT,
factory_date INT,
shift_index TINYINT,
shift_time_type TINYINT,
code NCHAR(64),
message NCHAR(256),
level NCHAR(32)
)
TAGS
( workstation_id BIGINT);
CREATE TABLE IF NOT EXISTS iot_data.super_aggregate_output
(
ts
TIMESTAMP,
pre_ts
TIMESTAMP,
output
BIGINT,
cur_output
BIGINT,
pre_output
BIGINT,
calendar_code
NCHAR(128),
factory_year INT,
factory_month TINYINT,
factory_week INT,
factory_date INT,
shift_index TINYINT,
shift_time_type TINYINT,
program NCHAR(128),
product_code NCHAR(128),
product_name NCHAR(128),
employee_id BIGINT
)
TAGS
( workstation_id BIGINT);
CREATE TABLE IF NOT EXISTS iot_data.super_aggregate_state (ts TIMESTAMP, end_time TIMESTAMP, duration_collect BIGINT, value_collect TINYINT, calendar_code NCHAR(128), factory_year INT, factory_month TINYINT, factory_week INT, factory_date INT, shift_index TINYINT, shift_time_type TINYINT, wcs TINYINT, rps TINYINT, is_deleted BOOL, is_plan TINYINT, employee_id BIGINT) TAGS (workstation_id BIGINT);
CREATE TABLE IF NOT EXISTS iot_data.super_collect_data
(
ts
TIMESTAMP,
v
NCHAR(256)
)
TAGS
( workstation_id
BIGINT,
n
NCHAR
(
64
));
CREATE TABLE IF NOT EXISTS super_dmp_log_signal
(
ts
TIMESTAMP,
trace_id
NCHAR(128),
type INT,
machine_name NCHAR(30),
affected_variable NCHAR(128),
variable_value NCHAR(128),
status INT
) TAGS
( machine_code NCHAR
(
128
), collect_month INT);
CREATE TABLE IF NOT EXISTS super_dmp_log_signal_flow
(
ts
TIMESTAMP,
trace_id
NCHAR(128),
type INT,
message NCHAR(255)
) TAGS
( machine_code NCHAR
(
128
), collect_month INT);
CREATE TABLE IF NOT EXISTS super_dmp_log_method_time
(
ts
TIMESTAMP,
trace_id
NCHAR(128),
type INT,
method_name NCHAR(128),
method_description NCHAR(128),
spend_time_seconds BIGINT
) TAGS
( machine_code NCHAR
(
128
), collect_month INT);
CREATE TABLE IF NOT EXISTS iot_data.super_aggregate_state_with_feedback (ts TIMESTAMP, end_time TIMESTAMP, duration_collect BIGINT, value_collect TINYINT, calendar_code NCHAR(128), factory_year INT, factory_month TINYINT, factory_week INT, factory_date INT, shift_index TINYINT, shift_time_type TINYINT, wcs TINYINT, rps TINYINT, is_deleted BOOL, is_plan TINYINT, feedback_id BIGINT) TAGS (workstation_id BIGINT);
CREATE TABLE IF NOT EXISTS iot_data.super_collect_data_json
(
ts
timestamp,
v
NCHAR(1024)
) TAGS
( workstation_id BIGINT);
DROP TABLE IF EXISTS iot_data.${tableName}
CREATE TABLE IF NOT EXISTS super_count_data
(
ts TIMESTAMP,
value_collect BIGINT,
calendar_code NCHAR(128),
factory_year INT,
factory_month TINYINT,
factory_week INT,
factory_date INT,
shift_index TINYINT,
shift_time_type TINYINT,
program NCHAR(128),
product_code NCHAR(128),
product_name NCHAR(128),
is_sync BOOL,
employee_id BIGINT
) TAGS (workstation_id BIGINT, usage_code BINARY(50));
CREATE TABLE IF NOT EXISTS super_pulse_data
(
ts TIMESTAMP,
value_collect BIGINT,
calendar_code NCHAR(128),
factory_year INT,
factory_month TINYINT,
factory_week INT,
factory_date INT,
shift_index TINYINT,
shift_time_type TINYINT,
program NCHAR(128),
product_code NCHAR(128),
product_name NCHAR(128),
is_sync BOOL,
employee_id BIGINT
) TAGS (workstation_id BIGINT, usage_code BINARY(50));
create table if not exists iot_data.super_aggregate_count_data
(
ts timestamp,
pre_ts timestamp,
output BIGINT,
cur_output BIGINT,
pre_output BIGINT,
calendar_code NCHAR(128),
factory_year INT,
factory_month TINYINT,
factory_week INT,
factory_date INT,
shift_index TINYINT,
shift_time_type TINYINT,
program NCHAR(128),
product_code NCHAR(128),
product_name NCHAR(128),
employee_id BIGINT
) TAGS(workstation_id BIGINT, usage_code BINARY(50));
create table if not exists iot_data.super_aggregate_pulse_data
(
ts timestamp,
pre_ts timestamp,
output BIGINT,
cur_output BIGINT,
pre_output BIGINT,
calendar_code NCHAR(128),
factory_year INT,
factory_month TINYINT,
factory_week INT,
factory_date INT,
shift_index TINYINT,
shift_time_type TINYINT,
program NCHAR(128),
product_code NCHAR(128),
product_name NCHAR(128),
employee_id BIGINT
) TAGS(workstation_id BIGINT, usage_code BINARY(50));