drop table if exists mmt_staging2.stg_specific_table_budni_hdl;
drop table if exists mmt_staging2.stg_process_table_budni_hdl;
drop table if exists  mmt_staging2.budni_hdl_Spec_H1_Block;
drop table if exists mmt_staging2.budni_hdl_power_test_Block;
drop table if exists mmt_staging2.budni_hdl_Lifting_Capacity_Test_Block;
drop table if exists mmt_staging2.budni_hdl_Maintenance_of_lift_load_int;
drop table if exists mmt_staging2.budni_hdl_Maintenance_of_lift_load_Block;
drop table if exists mmt_staging2.budni_hdl_Test_Obs_Summary_Block;


create table mmt_staging2.budni_hdl_Spec_H1_Block
(
syspk serial,
file_syspk int,
client_id int,
function_id int,
file_format text,
sheet_mnemonic text,
dummy_f text,
make text,
model text,
tractor_HP text,
rated_rpm text,
hydraulic_type text,
Pump_speed_at_rated_engine_speed_rpm text,
Steering_Type text,	
Oil text,
Lift_Rod_type_LH text,			
Lift_Rod_type_RH text,
Lift_Rod_Length_LH text,
Lift_Rod_Length_RH text,
Lower_link_Length_LH  text,
Lower_link_Length_RH text,
Pump_HP text,
ods_record int default 1,
rank int,
create_time timestamp DEFAULT current_timestamp
);

create table mmt_staging2.budni_hdl_power_test_block
(
syspk serial,
file_syspk int,
client_id int,
function_id int,
file_format text,
sheet_mnemonic text,
dummy_f text,
make text,
model text,
Pump_delivery_rate_at_minimum_pressure_and_rated_engine_speed_l_min text,
Maximum_hydraulic_power_kW text,
 Pump_delivery_rate_at_maximum_hydraulic_power_l_min text,
 Pressure_at_maximum_hydraulic_power_MPa text,
 Sustained_pressure_of_the_open_relief_valve_MPa text,
tapping_point_relief_valve_test text,
tapping_point_Pump_performance_test text,
tapping_point_Temperature_of_hydraulic_fluid_C text,
ods_record int default 1,
rank int,
create_time timestamp DEFAULT current_timestamp
);

create table mmt_staging2.budni_hdl_Lifting_Capacity_Test_Block
(
syspk serial,
file_syspk int,
client_id int,
function_id int,
file_format text,
sheet_mnemonic text,
dummy_f text,
make text,
model text,
column5 text,
column6 text,
column7 text,
column8 text,
column9 text,
column10 text,
column11 text,
ods_record int default 1,
rank int,
create_time timestamp DEFAULT current_timestamp
);

create table mmt_staging2.budni_hdl_Maintenance_of_lift_load_int
(
syspk serial,
file_syspk int,
client_id int,
function_id int,
file_format text,
sheet_mnemonic text,
dummy_f text,
make text,
model text,
column2 text,
column3 text,
column4 text,
column5 text,
column6 text,
column7 text,
column8 text,
column9 text,
column10 text,
column11 text,
column12 text,
ods_record int default 1,
rank int,
create_time timestamp DEFAULT current_timestamp
);

create table mmt_staging2.budni_hdl_Maintenance_of_lift_load_Block
(
syspk serial,
file_syspk int,
client_id int,
function_id int,
file_format text,
sheet_mnemonic text,
dummy_f text,
make text,
model text,
Force_applied_at_the_frame_kN text,
Temperature_of_hydraulic_fluid_at_the_start_of_test_C text,
Elapsed_time_minute text,
Cumulative_drop_in_height_of_lift_mm text,
ods_record int default 1,
rank int,
create_time timestamp DEFAULT current_timestamp
);

create table mmt_staging2.budni_hdl_Test_Obs_Summary_Block
(
syspk serial,
file_syspk int,
client_id int,
function_id int,
file_format text,
sheet_mnemonic text,
dummy_f text,
make text,
model text,
column2 text,
column3 text,
column4 text,
column5 text,
column6 text,
column7 text,
column8 text,
column9 text,
column10 text,
column11 text,
column12 text,
ods_record int default 1,
rank int,
create_time timestamp DEFAULT current_timestamp
);

create TABLE mmt_staging2.stg_process_table_budni_hdl (
	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_budni_hdl (
	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
);


