SET search_path TO  mmt_staging2;

drop table if exists mmt_staging2.FTHLG_SUM_Trac_H1_Block;

drop table if exists mmt_staging2.FTHLG_SUM_Trail_Type_Block;

drop table if exists mmt_staging2.FTHLG_SUM_Test_Condition_1_Block;

drop table if exists mmt_staging2.FTHLG_SUM_Test_Condition_2_Block;

drop table if exists mmt_staging2.FTHLG_SUM_Comments_By_Block;


drop table if exists mmt_staging2.stg_process_table_fthlg_sum;


drop table if exists mmt_staging2.stg_specific_table_fthlg_sum;


create table  mmt_staging2.FTHLG_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.FTHLG_SUM_Trail_Type_Block
(
syspk serial,
client_id int,
function_id int,
file_syspk int,
file_format text,
sheet_mnemonic text,
dummy_f text,
Trailer_Type text,
Tire_size_and_inflation_pressure_psi text,
No_Of_Axle text,
No_Of_Wheels text,	
Trailer_Gross_Weight_Kg text,
Tractor_Rear_Wheel_Center_to_Hitch_Point_Center_Distance_mm	text,
Tractor_Hitch_Height_from_Ground_mm	text,
Trailer_hitch_Height_above_ground_level_mm text,
Gradient_Slope_1_Degree	text,
Gradient_Slope_2_degree text,
Tractor_Hitch_Type text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);

create table mmt_staging2.FTHLG_SUM_Test_Condition_1_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,
Fuel_consumption_Ltr_hr text,
Mileage_Km_Ltr text,
Average_speed_of_travel_kmph text,
Total_distance_travelled_km text,
Gear_used_on_Straight_Road text,
Straight_road_RPM_Drop text,
Gear_used_on_Up_Slope_1 text,
Up_Slope_RPM_Drop_1 text,
Gear_used_on_Up_Slope_2 text,
Up_Slope_RPM_Drop_2 text,
Gear_used_on_Down_Slope text,
Down_Slope_RPM_Shoot_up text,
M_M_Performance_compared_to_respective_competitor_tractors_is_better_and_is_poor_than_competitor text,
Fuel_consumption_lit_hr_2 text,
Mileage_Km_Ltr_2 text,
M_M_Performance_in_compared_to_respective_competitor_tractors text,
Fuel_consumption_lit_hr_3 text,
Mileage_Km_Ltr_3 text,
Engine_Smoke_on_Load text,
Engine_acceleration_smoke text,
Range_Gear_Shifting text,
Speed_Gear_Shifting text,
Tractor_Steer_ability text,
Tractor_braking_performance text,
Front_Visibility text,
Implement_Accessibility text,
Front_end_lifting_during_operation text,
RPM_Recovery_Time text,
Engine_Vibration text,
Engine_Sound text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);


create table mmt_staging2.FTHLG_SUM_Test_Condition_2_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,
Fuel_consumption_Ltr_hr  text,
Mileage_Km_Ltr  text,
Average_speed_of_travel_kmph  text,
Total_distance_travelled_km  text,
Gear_used_on_Straight_Road  text,
Straight_road_RPM_Drop  text,
Gear_used_on_Up_Slope_1  text,
Up_Slope_RPM_Drop_1  text,
Gear_used_on_Up_Slope_2  text,
Up_Slope_RPM_Drop_2  text,
Gear_used_on_Down_Slope  text,
Down_Slope_RPM_Shoot_up  text,
M_M_Performance_compared_to_respective_competitor_tractors_is_better_and_is_poor_than_competitor text,
Fuel_consumption_lit_hr_2  text,
Mileage_Km_Ltr_2  text,
M_M_Performance_in_compared_to_respective_competitor_tractors text,
Fuel_consumption_lit_hr_3  text,
Mileage_Km_Ltr_3  text,
Engine_Smoke_on_Load  text,
Engine_acceleration_smoke  text,
Range_Gear_Shifting  text,
Speed_Gear_Shifting  text,
Tractor_Steer_ability  text,
Tractor_braking_performance  text,
Front_Visibility  text,
Implement_Accessibility  text,
Front_end_lifting_during_operation  text,
RPM_Recovery_Time  text,
Engine_Vibration  text,
Engine_Sound  text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);


create table mmt_staging2.FTHLG_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_Engineer_Comments_1 text,
Test_Manager_Comments_1 text,
Test_Engineer_Comments_2 text,
Test_Manager_Comments_2 text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);




create TABLE mmt_staging2.stg_process_table_fthlg_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_fthlg_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
);




