/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYS_constraint.sql **/
  EXEC P_ALTERPK 'PK_T_CTS_LAYOUTSCHEME', 'T_CTS_LAYOUTSCHEME', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_CTS_LAYOUTSCHEME_LAYOUTID') CREATE INDEX IDX_CTS_LAYOUTSCHEME_LAYOUTID ON T_CTS_LAYOUTSCHEME ( FLAYOUTNUMBER );


 EXEC P_ALTERPK 'PK_T_CTS_LAYOUTFIELDCTL', 'T_CTS_LAYOUTFIELDCTL', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_CTS_LAYOUTSCHEMEASSIGN', 'T_CTS_LAYOUTSCHEMEASSIGN', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_CTS_LAYOUTASSIGN_SCHEMEID') CREATE INDEX IDX_CTS_LAYOUTASSIGN_SCHEMEID ON T_CTS_LAYOUTSCHEMEASSIGN ( FLAYOUTSCHEMEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_CTS_LAYOUTASSIGN_ORGID') CREATE INDEX IDX_CTS_LAYOUTASSIGN_ORGID ON T_CTS_LAYOUTSCHEMEASSIGN ( FORGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_CTS_LAYOUTASSIGN_BTID') CREATE INDEX IDX_CTS_LAYOUTASSIGN_BTID ON T_CTS_LAYOUTSCHEMEASSIGN ( FBILLTYPEID );
 
 EXEC P_ALTERPK 'PK_T_CTS_LAYOUTFIELDCTL_L', 'T_CTS_LAYOUTFIELDCTL_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_CTS_LAYOUTSCHEME_L', 'T_CTS_LAYOUTSCHEME_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_CTS_LAYOUTSCHEMEASSIGN_L', 'T_CTS_LAYOUTSCHEMEASSIGN_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_CTS_LAYOUTASSIGN_L_ID') CREATE UNIQUE INDEX IDX_CTS_LAYOUTASSIGN_L_ID ON T_CTS_LAYOUTSCHEMEASSIGN_L ( FID ,FLOCALEID );
/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYS_constraint.sql **/
