/**Begin D:\PDM_UPGRADE\PDM1\HOM_constraint.sql **/
 EXEC P_ALTERPK 'PK_HOM_ACTIVITYINFO', 'T_HOM_ACTIVITYINFO', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_ACTIVITYINFO_FONBRDID') CREATE INDEX IDX_HOM_ACTIVITYINFO_FONBRDID ON T_HOM_ACTIVITYINFO ( FONBRDID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_AYINFO_FAYSCHEMEID') CREATE INDEX IDX_HOM_AYINFO_FAYSCHEMEID ON T_HOM_ACTIVITYINFO ( FACTIVITYSCHEMEID );


 EXEC P_ALTERPK 'PK_HOM_ACTIVITYINFODETAIL', 'T_HOM_ACTIVITYINFODETAIL', 'FENTRYID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_ACDETAIL_FACTIVITYID') CREATE INDEX IDX_HOM_ACDETAIL_FACTIVITYID ON T_HOM_ACTIVITYINFODETAIL ( FACTIVITYID );


 EXEC P_ALTERPK 'PK_HOM_ACTIVITYINFODETAIL_L', 'T_HOM_ACTIVITYINFODETAIL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_ONBRDBILL', 'T_HOM_ONBRDBILL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_ONBRDBILL_FCANDIDATEID') CREATE INDEX IDX_HOM_ONBRDBILL_FCANDIDATEID ON T_HOM_ONBRDBILL ( FCANDIDATEID );


 EXEC P_ALTERPK 'PK_HOM_ONBRDBILL_A', 'T_HOM_ONBRDBILL_A', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_ONBRDBILL_A_FRESUMENO') CREATE INDEX IDX_HOM_ONBRDBILL_A_FRESUMENO ON T_HOM_ONBRDBILL_A ( FRESUMENO );


 EXEC P_ALTERPK 'PK_HOM_ONBRDBILL_L', 'T_HOM_ONBRDBILL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_BREAKUPREASON', 'T_HOM_BREAKUPREASON', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_BREAKUPREASON_L', 'T_HOM_BREAKUPREASON_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_BREAKUPTYPE', 'T_HOM_BREAKUPTYPE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_BREAKUPTYPE_L', 'T_HOM_BREAKUPTYPE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_PLACE_L', 'T_HOM_PLACE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_PLACE', 'T_HOM_PLACE', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_INFOGROUPFIELD_L', 'T_HOM_INFOGROUPFIELD_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_INFOGROUP', 'T_HOM_INFOGROUP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_INFOGROUP') CREATE INDEX IDX_HOM_INFOGROUP ON T_HOM_INFOGROUP ( FINFOGROUPNAME );


 EXEC P_ALTERPK 'PK_HOM_INFOGROUP_L', 'T_HOM_INFOGROUP_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_INFOGROUPFIELD', 'T_HOM_INFOGROUPFIELD', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_INFOGROUPFIELD') CREATE INDEX IDX_HOM_INFOGROUPFIELD ON T_HOM_INFOGROUPFIELD ( FFIELDNAME );


 EXEC P_ALTERPK 'PK_HOM_UPLOADCONFIG', 'T_HOM_UPLOADCONFIG', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_UPLOADCONFIG_L', 'T_HOM_UPLOADCONFIG_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_INFOCONFIGFIELD', 'T_HOM_INFOCONFIGFIELD', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_FIELDNAME') CREATE INDEX IDX_FIELDNAME ON T_HOM_INFOCONFIGFIELD ( FFIELDNAMESHOW );


 EXEC P_ALTERPK 'PK_HOM_INFOCONFIGFIELDHIS', 'T_HOM_INFOCONFIGFIELDHIS', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_INFOCONFIGFIELDHIS') CREATE INDEX IDX_HOM_INFOCONFIGFIELDHIS ON T_HOM_INFOCONFIGFIELDHIS ( FFIELDREMARK );


 EXEC P_ALTERPK 'PK_HOM_INFOCONFIGFIELD_L', 'T_HOM_INFOCONFIGFIELD_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_INFOCONFIGFIELD_L') CREATE INDEX IDX_HOM_INFOCONFIGFIELD_L ON T_HOM_INFOCONFIGFIELD_L ( FDETAILID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HOM_INFOCONFIGFIELDHIS_L', 'T_HOM_INFOCONFIGFIELDHIS_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_INFOCONFIGFIELDHIS_L') CREATE INDEX IDX_HOM_INFOCONFIGFIELDHIS_L ON T_HOM_INFOCONFIGFIELDHIS_L ( FDETAILID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HOM_CONFIG', 'T_HOM_CONFIG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_CONFIG') CREATE INDEX IDX_HOM_CONFIG ON T_HOM_CONFIG ( FBUSINESSKEY );


 EXEC P_ALTERPK 'PK_HOM_CONFIG_L', 'T_HOM_CONFIG_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_INFOGROUPCONFIG', 'T_HOM_INFOGROUPCONFIG', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_INFOGROUPCONFIG') CREATE INDEX IDX_INFOGROUPCONFIG ON T_HOM_INFOGROUPCONFIG ( FINFOGROUPNAME );


 EXEC P_ALTERPK 'PK_HOM_INFOGROUPCONFIGHIS', 'T_HOM_INFOGROUPCONFIGHIS', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_INFOGROUPCONFIGHIS') CREATE INDEX IDX_HOM_INFOGROUPCONFIGHIS ON T_HOM_INFOGROUPCONFIGHIS ( FINFOGROUPNAME );


 EXEC P_ALTERPK 'PK_HOM_INFOGROUPCONFIG_L', 'T_HOM_INFOGROUPCONFIG_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_INFOGROUPCONFIGHIS_L', 'T_HOM_INFOGROUPCONFIGHIS_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_INFOCOLLECTCONFHIS', 'T_HOM_INFOCOLLECTCONFHIS', 'FVID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_CONFIGNAMEHIS') CREATE INDEX IDX_CONFIGNAMEHIS ON T_HOM_INFOCOLLECTCONFHIS ( FNAME );


 EXEC P_ALTERPK 'PK_HOM_INFOCOLLECTCONFIG', 'T_HOM_INFOCOLLECTCONFIG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_NAME') CREATE INDEX IDX_NAME ON T_HOM_INFOCOLLECTCONFIG ( FNAME );


 EXEC P_ALTERPK 'PK_HOM_INFOCOLLECTCONFHIS_L', 'T_HOM_INFOCOLLECTCONFHIS_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_INFOCOLLECTCONFHIS_L') CREATE INDEX IDX_HOM_INFOCOLLECTCONFHIS_L ON T_HOM_INFOCOLLECTCONFHIS_L ( FVID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_HOM_INFOCOLLECTCONFIG_L', 'T_HOM_INFOCOLLECTCONFIG_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_HOM_CONFIGENTITY', 'T_HOM_CONFIGENTITY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_CONFIGENTITY') CREATE INDEX IDX_HOM_CONFIGENTITY ON T_HOM_CONFIGENTITY ( FENTITYKEY );


 EXEC P_ALTERPK 'PK_HOM_INFOCONFCERT', 'T_HOM_INFOCONFCERT', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_INFOCONFCERT') CREATE INDEX IDX_HOM_INFOCONFCERT ON T_HOM_INFOCONFCERT ( FCERTTYPEID );


 EXEC P_ALTERPK 'PK_HOM_INFOCONFCERTHIS', 'T_HOM_INFOCONFCERTHIS', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_INFOCONFCERTHIS') CREATE INDEX IDX_HOM_INFOCONFCERTHIS ON T_HOM_INFOCONFCERTHIS ( FCERTTYPEID );


 EXEC P_ALTERPK 'PK_HOM_COLLECT', 'T_HOM_COLLECT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HOM_COLLECT') CREATE INDEX IDX_HOM_COLLECT ON T_HOM_COLLECT ( FONBOARDID );



/**End D:\PDM_UPGRADE\PDM1\HOM_constraint.sql **/
