drop table if exists mmt_staging2.IHT_NST_H1_Int;
drop table if exists mmt_staging2.IHT_NST_H1_block;
drop table if exists mmt_staging2.IHT_NST_Tyre_Details_Block;
drop table if exists mmt_staging2.IHT_NST_Engine_RPM_Atmos_Int;
drop table if exists mmt_staging2.IHT_NST_Engine_RPM_Block;
 drop table if exists mmt_staging2.IHT_NST_Weight_Block;
drop table if exists mmt_staging2.IHT_NST_Atmos_Cond_Block;
drop table if exists mmt_staging2.IHT_NST_STAND_Noise_Block;
drop table if exists mmt_staging2.IHT_NST_OEL_Noise_Block;
drop table if exists mmt_staging2.IHT_NST_Footer_Block;
drop table if exists mmt_staging2.stg_specific_table_IHT_NST;
drop table if exists mmt_staging2.stg_process_table_IHT_NST;

create table mmt_staging2.IHT_NST_H1_INT 
(syspk serial,dummy_f text,file_syspk int,client_id int,function_id int
,make text,model text,file_format text,sheet_mnemonic text,c1 text,c2 text);

create table mmt_staging2.IHT_NST_H1_Block
(
syspk serial,
client_id int,
function_id int,
file_syspk int,
dummy_f text,
make text,
model text,
file_format text,
sheet_mnemonic text,
Test_Request_no text,
Sample_Receipt_Date text,
Test_report_No text,
Tractor_Model text,
Generation text,
Customer_Name text, 
Test_Engineer text,
Test_Report_Date text,
No_of_Sample  text,
Test_Start_Date text,
Test_End_Date text,
Tractor_Sr_No text,
Test_Facility text,
Operator_Name text,
Project_Group text,
Test_Standard_Refer text,
Objective text,
condition text,
create_time timestamp DEFAULT current_timestamp
);

create table mmt_staging2.IHT_NST_Tyre_Details_Block
(
syspk serial,
client_id int,
function_id int,
file_syspk int,
dummy_f text,
make text,
model text,
file_format text,
sheet_mnemonic text,
Tyre_Details text,
Tyre_Make text,
Tyre_size text,
Ply_Rating text,
Load_Carrying_Capacity text,
Wheel_rim_Make_size text,
create_time timestamp DEFAULT current_timestamp
);

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

create table mmt_staging2.IHT_NST_Engine_RPM_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,
low_idle_declared text,
low_idle_observed text,
high_idle_declared text,
high_idle_observed text,
rated_rpm_declared text,
rated_rpm_observed text,
Engine_to_PTO_Ratio text,
low_idle_remark text,
high_idle_remark text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);

create table mmt_staging2.IHT_NST_Weight_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,
Front_weight_declared text,
Front_weight_observed text,
Rear_weight_declared text,
Rear_weight_observed text,
Total_weight_declared text,
Total_weight_observed text,
front_weight_remark text,
rear_weight_remark text,
total_weight_remark text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);

create table mmt_staging2.IHT_NST_Atmos_Cond_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,
Ambient_temp_C text,
humidity text,
Pressure_kPa text,
Background_Noise text,
wind_velocity text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);

create table mmt_staging2.IHT_NST_STAND_Noise_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,
remarks text,
acceptance_criteria text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);

create table mmt_staging2.IHT_NST_OEL_Noise_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,
remarks text,
acceptance_criteria text,
rank int,
ods_record int default 1,
create_time timestamp DEFAULT current_timestamp
);

create table mmt_staging2.IHT_NST_Footer_Block
(
syspk serial,
client_id int,
function_id int,
dummy_f text,
file_syspk int,
make text,
model text,
file_format text,
sheet_mnemonic text,
prepared_by text,
reviewed_by text,
approved_by text,
replaces text,
revision_no text,
prepared_date text,
reviewed_date text,
approved_date text,
comments text,
rev1 text,
rev2 text,
rev3 text,
create_time timestamp DEFAULT current_timestamp
);

create TABLE mmt_staging2.stg_process_table_IHT_NST (
     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_IHT_NST (
     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
);


