/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MAL_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_MAL_APILOG', 'T_MAL_APILOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MAL_APILOG_FEXTSYSAPI') CREATE INDEX IDX_MAL_APILOG_FEXTSYSAPI ON T_MAL_APILOG ( FEXTSYSAPI );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MAL_APILOG_FCREATETIME') CREATE INDEX IDX_MAL_APILOG_FCREATETIME ON T_MAL_APILOG ( FCREATETIME );


 EXEC P_ALTERPK 'PK_T_MAL_APILOGBACK', 'T_MAL_APILOGBACK', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MAL_APILOGBACK_FEXTSYSAPI') CREATE INDEX IDX_MAL_APILOGBACK_FEXTSYSAPI ON T_MAL_APILOGBACK ( FEXTSYSAPI );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MAL_APILOGBACK_FCREATETIME') CREATE INDEX IDX_MAL_APILOGBACK_FCREATETIME ON T_MAL_APILOGBACK ( FCREATETIME );


 EXEC P_ALTERPK 'PK_T_MAL_APILOGSETTING', 'T_MAL_APILOGSETTING', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'PK_MAL_APILOGSETTING') CREATE INDEX PK_MAL_APILOGSETTING ON T_MAL_APILOGSETTING ( FAUTOARCHIVEAMT );


 EXEC P_ALTERPK 'PK_T_MAL_EXT_APISETENTRY', 'T_MAL_EXT_APISETENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MAL_APISETENTRY_FID_FSEQ') CREATE INDEX IDX_MAL_APISETENTRY_FID_FSEQ ON T_MAL_EXT_APISETENTRY ( FID ,FSEQ );


 EXEC P_ALTERPK 'PK_T_MAL_EXTAPISET', 'T_MAL_EXTAPISET', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MAL_EXTAPISET_FNUMBER') CREATE INDEX IDX_MAL_EXTAPISET_FNUMBER ON T_MAL_EXTAPISET ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_MAL_EXTAPISET_L', 'T_MAL_EXTAPISET_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MAL_EXTAPISET_L_FID') CREATE INDEX IDX_MAL_EXTAPISET_L_FID ON T_MAL_EXTAPISET_L ( FLOCALEID ,FID );


 EXEC P_ALTERPK 'PK_T_MAL_EXTSYS', 'T_MAL_EXTSYS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MAL_EXTSYS') CREATE INDEX IDX_MAL_EXTSYS ON T_MAL_EXTSYS ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_MAL_EXTSYS_API', 'T_MAL_EXTSYS_API', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MAL_EXTSYS_API_FNUMBER') CREATE INDEX IDX_MAL_EXTSYS_API_FNUMBER ON T_MAL_EXTSYS_API ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_MAL_EXTSYS_API_L', 'T_MAL_EXTSYS_API_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MAL_EXTSYS_API_L_FID') CREATE INDEX IDX_MAL_EXTSYS_API_L_FID ON T_MAL_EXTSYS_API_L ( FLOCALEID );


 EXEC P_ALTERPK 'PK_T_MAL_EXTSYS_L', 'T_MAL_EXTSYS_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MAL_EXTSYS_L_FID') CREATE INDEX IDX_MAL_EXTSYS_L_FID ON T_MAL_EXTSYS_L ( FLOCALEID ,FID );


 EXEC P_ALTERPK 'PK_T_MAL_EXTSYSAPI_INPUTS', 'T_MAL_EXTSYSAPI_INPUTS', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MAL_API_INPUTS_FID_FSEQ') CREATE INDEX IDX_MAL_API_INPUTS_FID_FSEQ ON T_MAL_EXTSYSAPI_INPUTS ( FSEQ );


 EXEC P_ALTERPK 'PK_T_MAL_EXTSYSAPI_OUTPUTS', 'T_MAL_EXTSYSAPI_OUTPUTS', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_MAL_API_OUTPUTS_FID_FSEQ') CREATE INDEX IDX_MAL_API_OUTPUTS_FID_FSEQ ON T_MAL_EXTSYSAPI_OUTPUTS ( FID ,FSEQ );



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MAL_constraint.sql **/
