CREATE DATABASE root.f2;

create device template output aligned(workstation_id INT64,value_collect INT64 encoding=TS_2DIFF,calendar_code TEXT encoding=DICTIONARY,factory_year INT32 encoding=RLE,factory_month INT32 encoding=RLE,factory_date INT32 encoding=RLE,factory_week INT32 encoding=RLE,shift_index INT32,shift_time_type INT32,is_sync BOOLEAN encoding=RLE,employee_id INT64);

create device template aggregate_output aligned(workstation_id INT64,output INT64 encoding=TS_2DIFF,cur_output INT64 encoding=TS_2DIFF,pre_output INT64 encoding=TS_2DIFF,pre_time INT64 encoding=TS_2DIFF,calendar_code TEXT encoding=DICTIONARY,factory_year INT32 encoding=RLE,factory_month INT32 encoding=RLE,factory_date INT32 encoding=RLE,factory_week INT32 encoding=RLE,shift_index INT32,shift_time_type INT32,employee_id INT64);

create device template aggregate_state aligned(workstation_id INT64,end_time INT64,duration_collect INT64 encoding=TS_2DIFF,calendar_code TEXT encoding=DICTIONARY,factory_year INT32 encoding=RLE,factory_month INT32 encoding=RLE,factory_date INT32 encoding=RLE,factory_week INT32 encoding=RLE,shift_index INT32 encoding=TS_2DIFF,shift_time_type INT32 encoding=TS_2DIFF,wcs INT32 encoding=TS_2DIFF,rps INT32 encoding=TS_2DIFF,is_deleted BOOLEAN encoding=RLE,is_plan INT32,employee_id INT64);

create device template aggregate_state_with_feedback aligned(workstation_id INT64,end_time INT64,duration_collect INT64 encoding=TS_2DIFF,calendar_code TEXT encoding=DICTIONARY,factory_year INT32 encoding=RLE,factory_month INT32 encoding=RLE,factory_date INT32 encoding=RLE,factory_week INT32 encoding=RLE,shift_index INT32 encoding=TS_2DIFF,shift_time_type INT32 encoding=TS_2DIFF,wcs INT32 encoding=TS_2DIFF,rps INT32 encoding=TS_2DIFF,is_deleted BOOLEAN encoding=RLE,is_plan INT32,feedback_id INT64);

create device template state aligned(workstation_id INT64,value_collect INT32,calendar_code TEXT encoding=DICTIONARY,factory_year INT32 encoding=RLE,factory_month INT32 encoding=RLE,factory_date INT32 encoding=RLE,factory_week INT32 encoding=RLE,shift_index INT32 encoding=TS_2DIFF,shift_time_type INT32 encoding=TS_2DIFF,wcs INT32 encoding=TS_2DIFF,rps INT32 encoding=TS_2DIFF,is_fix_point BOOLEAN encoding=RLE,is_sync BOOLEAN encoding=RLE,is_plan INT32, feedback_point_type INT32,feedback_id INT64,is_deleted BOOLEAN encoding=RLE,employee_id INT64);

create device template process_param aligned (workstation_id INT64,v TEXT,n TEXT);

create device template alarm aligned(workstation_id INT64,calendar_code TEXT encoding=DICTIONARY,factory_year INT32 encoding=RLE,factory_month INT32 encoding=RLE,factory_date INT32 encoding=RLE,factory_week INT32 encoding=RLE,shift_index INT32,shift_time_type INT32,code TEXT,message TEXT,level TEXT);

create device template prog_name aligned(workstation_id INT64,name TEXT,part_no TEXT,process_no TEXT,version TEXT,seg_total INT32,seg_no INT32);
