SET search_path TO  mmt_staging2;


drop table if exists mmt_staging2.FTWET_SUM_Trac_H1_Block;

drop table if exists mmt_staging2.FTWET_SUM_Implement_Block;

drop table if exists mmt_staging2.FTWET_SUM_Cage_Wheel_Block;
;
drop table if exists mmt_staging2.FTWET_SUM_Test_Condition_Block;

drop table if exists mmt_staging2.FTWET_SUM_Comments_By_Block;

drop table if exists mmt_staging2.stg_process_table_ftwet_sum;

drop table if exists mmt_staging2.stg_specific_table_ftwet_sum;


create table mmt_staging2.FTWET_SUM_Trac_H1_Block
(
syspk serial,
client_id int,
function_id int,
file_syspk int,
file_format text,
sheet_mnemonic text,
dummy_f text,
Tractor_Model text,	
Tractor_Make text,	
Tractor_Engine_HP text,
Rated_RPM text,	
Transmission_Type text,
Wheel_Drive_Type text,
FIP_Type text,	
Steering_Type text,	
Tractor_Weight_kg_Front text,
Tractor_Weight_kg_Rear text,
Tractor_Weight_kg_Total text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);


create table mmt_staging2.FTWET_SUM_Implement_Block
(
syspk serial,
client_id int,
function_id int,
file_syspk int,
file_format text,
sheet_mnemonic text,
dummy_f text,
Make_of_Implement text,
Implement_Type text,
Implement_Size text,
Hitch_Category text,
Implement_Weight text,	
Soil_Type text,
Moisture_Content text,	
Bulk_Density_g_cc text,
Soil_Cone_index text,
Field_Condition	text,
Season text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);

create table mmt_staging2.FTWET_SUM_Cage_Wheel_Block
(
syspk serial,
client_id int,
function_id int,
file_syspk int,
file_format text,
sheet_mnemonic text,
dummy_f text,
Type_of_Cage_Wheel text,
Cage_Wheel_Width_mm text,
Cage_wheel_Weight text,
Cage_Wheel_inner_Outer_Ring_Dia_mm  text,
Cage_Wheel_Center_Ring_Dia_mm  text,
Distance_between_RHS_LHS_cage_wheel_Inner_Ring_mm  text,
No_of_angles_on_cage_wheel  text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);


create table mmt_staging2.FTWET_SUM_Test_Condition_Block
(
syspk serial,
client_id int,
function_id int,
file_syspk int,
file_format text,
sheet_mnemonic text,
dummy_f text,
test_iterationnumber text,
Test_Condition text,
Test_Date text,
Tractor_Model text,
Engine_RPM_set text,
PTO_RPM_set text,
Gear_Used text,
Nominal_Speed_KMPH text,
Engine_RPM_Drop_on_straight_1st_Pass text,
Engine_RPM_Drop_on_straight_2nd_Pass text,
Engine_RPM_Drop_on_straight_3rd_Pass text,
Engine_RPM_Drop_on_turn_1st_Pass text,
Engine_RPM_Drop_on_turn_2nd_Pass text,
Engine_RPM_Drop_on_turn_3rd_Pass text,
No_of_passes text,
Avg_Depth_of_cut_cm text,
Fuel_consumption_lit_hr text,
Area_covered_acr_hr text,
Fuel_consumption_lit_Acr text,
M_M_Performance_in_compared_to_respective_competitor_tractors text,
Fuel_consumption_lit_hr_2 text,
Area_covered_acr_hr_2 text,
Fuel_consumption_lit_Acr_2 text,
Trail_Observations text,
Engine_Smoke_on_Load text,
Engine_acceleration_smoke text,
Draft_Response text,
Tractor_Steer_ability text,
Tractor_braking_performance text,
Front_Visibility text,
Implement_Accessibility text,
Front_Wheel_dragging_at_turning text,
Front_end_lifting_during_operation text,
RPM_Recovery_Time text,
Engine_Vibration text,
Engine_Sound text,
Implement_Lifting_Lowering_response  text,
Pulverization_Quality text,
Pulverization_Index text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);


create table mmt_staging2.FTWET_SUM_Comments_By_Block
(
syspk serial,
client_id int,
function_id int,
file_syspk int,
file_format text,
sheet_mnemonic text,
dummy_f text,
Tractor_Model text,
Test_Manager_Comments text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);


create TABLE mmt_staging2.stg_process_table_ftwet_sum (
	generic_syspk int,
file_syspk bigint,
file_name varchar(1024) NULL,
file_date date NULL,
file_format varchar(1024) NULL,
sheet_number int4 NULL,
sheet_name varchar(1024) NULL,
sheet_format text,
sheet_mnemonic varchar(1024) NULL,
row_number int4 NULL,
file_creation_date timestamp NULL,
column1 varchar(1024) NULL,
column2 varchar(1024) NULL,
column3 varchar(1024) NULL,
column4 varchar(1024) NULL,
column5 varchar(1024) NULL,
column6 varchar(1024) NULL,
column7 varchar(1024) NULL,
column8 varchar(1024) NULL,
column9 varchar(1024) NULL,
column10 varchar(1024) NULL,
column11 varchar(1024) NULL,
column12 varchar(1024) NULL,
column13 varchar(1024) NULL,
column14 varchar(1024) NULL,
column15 varchar(1024) NULL,
column16 varchar(1024) NULL,
column17 varchar(1024) NULL,
column18 varchar(1024) NULL,
column19 varchar(1024) NULL,
column20 varchar(1024) NULL,
column21 varchar(1024) NULL,
column22 varchar(1024) NULL,
column23 varchar(1024) NULL,
column24 varchar(1024) NULL,
column25 varchar(1024) NULL,
column26 varchar(1024) NULL,
column27 varchar(1024) NULL,
column28 varchar(1024) NULL,
column29 varchar(1024) NULL,
column30 varchar(1024) NULL,
column31 varchar(1024) NULL,
column32 varchar(1024) NULL,
column33 varchar(1024) NULL,
column34 varchar(1024) NULL,
column35 varchar(1024) NULL,
column36 varchar(1024) NULL,
column37 varchar(1024) NULL,
column38 varchar(1024) NULL,
column39 varchar(1024) NULL,
column40 varchar(1024) NULL,
column41 varchar(1024) NULL,
column42 varchar(1024) NULL,
column43 varchar(1024) NULL,
column44 varchar(1024) NULL,
column45 varchar(1024) NULL,
column46 varchar(1024) NULL,
column47 varchar(1024) NULL,
column48 varchar(1024) NULL,
column49 varchar(1024) NULL,
column50 varchar(1024) NULL,
column51 varchar(1024) NULL,
column52 varchar(1024) NULL,
column53 varchar(1024) NULL,
is_rownumber_fetched int4 NULL,
create_time timestamp DEFAULT current_timestamp,
rank int4 NULL,
rank_tag text null
);


CREATE TABLE mmt_staging2.stg_specific_table_ftwet_sum (
	generic_syspk int,
file_syspk bigint,
file_name varchar(1024) NULL,
file_date date NULL,
file_format varchar(1024) NULL,
sheet_number int4 NULL,
sheet_name varchar(1024) NULL,
sheet_format text,
sheet_mnemonic varchar(1024) NULL,
row_number int4 NULL,
file_creation_date timestamp NULL,
column1 varchar(1024) NULL,
column2 varchar(1024) NULL,
column3 varchar(1024) NULL,
column4 varchar(1024) NULL,
column5 varchar(1024) NULL,
column6 varchar(1024) NULL,
column7 varchar(1024) NULL,
column8 varchar(1024) NULL,
column9 varchar(1024) NULL,
column10 varchar(1024) NULL,
column11 varchar(1024) NULL,
column12 varchar(1024) NULL,
column13 varchar(1024) NULL,
column14 varchar(1024) NULL,
column15 varchar(1024) NULL,
column16 varchar(1024) NULL,
column17 varchar(1024) NULL,
column18 varchar(1024) NULL,
column19 varchar(1024) NULL,
column20 varchar(1024) NULL,
column21 varchar(1024) NULL,
column22 varchar(1024) NULL,
column23 varchar(1024) NULL,
column24 varchar(1024) NULL,
column25 varchar(1024) NULL,
column26 varchar(1024) NULL,
column27 varchar(1024) NULL,
column28 varchar(1024) NULL,
column29 varchar(1024) NULL,
column30 varchar(1024) NULL,
column31 varchar(1024) NULL,
column32 varchar(1024) NULL,
column33 varchar(1024) NULL,
column34 varchar(1024) NULL,
column35 varchar(1024) NULL,
column36 varchar(1024) NULL,
column37 varchar(1024) NULL,
column38 varchar(1024) NULL,
column39 varchar(1024) NULL,
column40 varchar(1024) NULL,
column41 varchar(1024) NULL,
column42 varchar(1024) NULL,
column43 varchar(1024) NULL,
column44 varchar(1024) NULL,
column45 varchar(1024) NULL,
column46 varchar(1024) NULL,
column47 varchar(1024) NULL,
column48 varchar(1024) NULL,
column49 varchar(1024) NULL,
column50 varchar(1024) NULL,
column51 varchar(1024) NULL,
column52 varchar(1024) NULL,
column53 varchar(1024) NULL,
is_rownumber_fetched int4 null,
create_time timestamp DEFAULT current_timestamp
);

