/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\MDL_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_META_FEATURESBLACKLIST', 'T_META_FEATURESBLACKLIST', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_DM_ELEMENTCATEGORY', 'T_DM_ELEMENTCATEGORY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_DM_ELEMENTCATEGORY_FID') CREATE UNIQUE INDEX IDX_DM_ELEMENTCATEGORY_FID ON T_DM_ELEMENTCATEGORY ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_DM_ELEMENTCATEGORY_L', 'T_DM_ELEMENTCATEGORY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_DM_PROPERTY_L', 'T_DM_PROPERTY_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_DM_DOMAINTYPE', 'T_DM_DOMAINTYPE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_DM_DOMAINTYPE_L', 'T_DM_DOMAINTYPE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_DM_ELEMENTTYPEENTRY_L', 'T_DM_ELEMENTTYPEENTRY_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_DM_ELEMENTTYPEENTRY_L') CREATE INDEX IDX_DM_ELEMENTTYPEENTRY_L ON T_DM_ELEMENTTYPEENTRY_L ( FENTRYID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_DM_ELEMENTTYPEENTRY', 'T_DM_ELEMENTTYPEENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_DM_ELEMENTTYPE', 'T_DM_ELEMENTTYPE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_DM_PROPERTY', 'T_DM_PROPERTY', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_DM_ELEMENTTYPE_L', 'T_DM_ELEMENTTYPE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_DM_OPERATION', 'T_DM_OPERATION', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_DM_OPERATION_NUMBER') CREATE UNIQUE INDEX IDX_T_DM_OPERATION_NUMBER ON T_DM_OPERATION ( FNUMBER );


 EXEC P_ALTERPK 'PK_DM_OPERATION_L', 'T_DM_OPERATION_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_DM_OPERATIONAPP', 'T_DM_OPERATIONAPP', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_DM_OPSERVICE', 'T_DM_OPSERVICE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_DM_OPSERVICE_NUMBER') CREATE UNIQUE INDEX IDX_T_DM_OPSERVICE_NUMBER ON T_DM_OPSERVICE ( FNUMBER );


 EXEC P_ALTERPK 'PK_DM_OPSERVICE_L', 'T_DM_OPSERVICE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_DM_OPSERVICEAPP', 'T_DM_OPSERVICEAPP', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_DM_RULE', 'T_DM_RULE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_DM_RULE_NUMBER') CREATE UNIQUE INDEX IDX_T_DM_RULE_NUMBER ON T_DM_RULE ( FNUMBER );


 EXEC P_ALTERPK 'PK_DM_RULE_L', 'T_DM_RULE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_DM_VALIDATOR', 'T_DM_VALIDATOR', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_DM_VALIDATOR_NUMBER') CREATE UNIQUE INDEX IDX_T_DM_VALIDATOR_NUMBER ON T_DM_VALIDATOR ( FNUMBER );


 EXEC P_ALTERPK 'PK_DM_VALIDATOR_L', 'T_DM_VALIDATOR_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_DM_VALIDATORAPPRANGE', 'T_DM_VALIDATORAPPRANGE', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_META_BIZEXTCASE_L', 'T_META_BIZEXTCASE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_DM_DMIMPORT', 'T_DM_DMIMPORT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_DM_DMIMPORT') CREATE INDEX IDX_T_DM_DMIMPORT ON T_DM_DMIMPORT ( FBILLNO );


 EXEC P_ALTERPK 'PK_T_DM_DMIMPORTENTRY', 'T_DM_DMIMPORTENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_META_BIZEXTCASE', 'T_META_BIZEXTCASE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_DM_DMEXPORT', 'T_DM_DMEXPORT', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_DM_DMEXPORTENTRY', 'T_DM_DMEXPORTENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_META_BIZEXTPLUGIN_S', 'T_META_BIZEXTPLUGIN_S', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_META_BIZEXTPLUGIN', 'T_META_BIZEXTPLUGIN', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_META_BIZEXTPLUGIN_NO') CREATE INDEX IDX_META_BIZEXTPLUGIN_NO ON T_META_BIZEXTPLUGIN ( FPLUGINCLASS );



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