/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\FA_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_FA_LEASE_CONTRACT_L', 'T_FA_LEASE_CONTRACT_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_FA_LEASE_PAY_PLAN', 'T_FA_LEASE_PAY_PLAN', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_PAY_PLAN_FK') CREATE INDEX IDX_FA_PAY_PLAN_FK ON T_FA_LEASE_PAY_PLAN ( FID );


 EXEC P_ALTERPK 'PK_T_FA_LEASE_RENT_SETTLE', 'T_FA_LEASE_RENT_SETTLE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_RENTSETTLE_CONTRACTID') CREATE INDEX IDX_FA_RENTSETTLE_CONTRACTID ON T_FA_LEASE_RENT_SETTLE ( FLEASECONTRACTID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_RENTSETTLE_ORG_DATE') CREATE INDEX IDX_FA_RENTSETTLE_ORG_DATE ON T_FA_LEASE_RENT_SETTLE ( FORGID ,FSETTLEDATE );


 EXEC P_ALTERPK 'PK_T_FA_LEASE_CONTRACT', 'T_FA_LEASE_CONTRACT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FA_LEASECONTRACT_ORGDATE') CREATE INDEX IDX_FA_LEASECONTRACT_ORGDATE ON T_FA_LEASE_CONTRACT ( FORGID ,FLEASESTARTDATE );



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