drop table  if exists mmt_staging2.BUDNI_BRK_Spec_H1_Block;
drop table if exists mmt_staging2.BUDNI_BRK_Service_Barke_Test_Int;
drop table if exists mmt_staging2.BUDNI_BRK_service_cold_standard_maximum_Block;
drop table if exists mmt_staging2.BUDNI_BRK_service_cold_ballasted_maximum_Block;
drop table if exists mmt_staging2.BUDNI_BRK_service_cold_standard_25kmph_Block;
drop table if exists mmt_staging2.BUDNI_BRK_service_cold_ballasted_25kmph_Block;
drop table if exists mmt_staging2.BUDNI_BRK_service_fade_standard_maximum_Block;
drop table if exists mmt_staging2.BUDNI_BRK_service_fade_ballasted_25kmph_Block;
drop table if exists mmt_staging2.BUDNI_BRK_other_observations_Block;
drop table if exists mmt_staging2.BUDNI_BRK_Parking_Barke_Test_Int ;
drop table if exists mmt_staging2.BUDNI_BRK_Parking_Barke_Test_Block;
drop table if exists mmt_staging2.BUDNI_BRK_Test_Obs_Summary_Block;
drop table if exists mmt_staging2.stg_process_table_BUDNI_BRK;
drop table if exists mmt_staging2.stg_specific_table_BUDNI_BRK;


create table mmt_staging2.BUDNI_BRK_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,
Type_of_brake text,
Type_of_track text ,
brake_free_play_lh text,
brake_free_play_rh text,
maximum_attainable_speed_kmph_unballasted text,
maximum_attainable_speed_kmph_ballasted text,
rank int,
ods_record int default 1
);

create table mmt_staging2.BUDNI_BRK_Service_Barke_Test_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,
column1 text,
column2 text,
column3 text,
column4 text,
column5 text,
column6 text,
column7 text,
column8 text,
column9 text,
rank int,
ods_record int default 1
);

create table mmt_staging2.BUDNI_BRK_service_cold_standard_maximum_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,
brake_test_type text,
brake_test_name text,
speed_condition text,
ballast_condition text,
Braking_device_control_force_N text,
Mean_deceleration_m_sec2 text,
Stopping_distance_m text,
rank int,
ods_record int default 1
);

create table mmt_staging2.BUDNI_BRK_service_cold_ballasted_maximum_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,
brake_test_type text,
brake_test_name text,
speed_condition text,
ballast_condition text,
Braking_device_control_force_N text,
Mean_deceleration_m_sec2 text,
Stopping_distance_m text,
rank int,
ods_record int default 1
);

create table mmt_staging2.BUDNI_BRK_service_cold_standard_25kmph_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,
brake_test_type text,
brake_test_name text,
speed_condition text,
ballast_condition text,
Braking_device_control_force_N text,
Mean_deceleration_m_sec2 text,
Stopping_distance_m text,
rank int,
ods_record int default 1
);

create table mmt_staging2.BUDNI_BRK_service_cold_ballasted_25kmph_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,
brake_test_type text,
brake_test_name text,
speed_condition text,
ballast_condition text,
Braking_device_control_force_N text,
Mean_deceleration_m_sec2 text,
Stopping_distance_m text,
rank int,
ods_record int default 1
);

create table mmt_staging2.BUDNI_BRK_service_fade_standard_maximum_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,
brake_test_type text,
brake_test_name text,
speed_condition text,
ballast_condition text,
Braking_device_control_force_N text,
Mean_deceleration_m_sec2 text,
Stopping_distance_m text,
rank int,
ods_record int default 1
);

create table mmt_staging2.BUDNI_BRK_service_fade_ballasted_25kmph_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,
brake_test_type text,
brake_test_name text,
speed_condition text,
ballast_condition text,
Braking_device_control_force_N text,
Mean_deceleration_m_sec2 text,
Stopping_distance_m text,
rank int,
ods_record int default 1
);

create table mmt_staging2.BUDNI_BRK_other_observations_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,
column1 text,
column2 text,
column3 text,
column4 text,
column5 text,
column6 text,
column7 text,
column8 text,
column9 text,
rank int,
ods_record int default 1
);

create table mmt_staging2.budni_brk_parking_barke_test_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,
column1 text,
column2 text,
column3 text,
column4 text,
column5 text,
column6 text,
column7 text,
column8 text,
column9 text,
rank int,
ods_record int default 1
);

create table mmt_staging2.BUDNI_BRK_Parking_Barke_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,
particulars text,
facing text,
Braking_device_control_force text,
Efficacy_of_parking_brake text,	
rank int,
ods_record int default 1
);



create table mmt_staging2.BUDNI_BRK_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,
column3 text,
column4 text,
column5 text,
column6 text,
column7 text,
column8 text,
column9 text,
rank int,
ods_record int default 1
);

create TABLE mmt_staging2.stg_process_table_BUDNI_BRK (
	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_BRK (
	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
);


