/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\EB_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_TEMPLATE' AND KSQL_COL_NAME ='FRULEGROUP') 
 ALTER TABLE T_EB_TEMPLATE ADD (FRULEGROUP NCLOB );


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_BIZRULESET' AND KSQL_COL_NAME ='FFORMULASHOW') 
 ALTER TABLE T_EB_BIZRULESET ADD (FFORMULASHOW NCLOB );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_DATASETCATALOG' AND KSQL_COL_NAME IN ('FMODELID')) 
 ALTER TABLE T_EB_DATASETCATALOG ADD (FMODELID BIGINT DEFAULT 0 NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_DATASETCATALOG' AND KSQL_COL_NAME IN ('FCREATORID')) 
 ALTER TABLE T_EB_DATASETCATALOG ADD (FCREATORID BIGINT DEFAULT 0 NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_DATASETLOG_MODEL') CREATE INDEX IDX_EB_DATASETLOG_MODEL ON T_EB_DATASETCATALOG ( FMODELID );
 
  EXEC p_AlterColumn 'T_EB_TEMPLATE', 'FVARBASEFOREB', 'NVARCHAR(150)', 'NOT NULL', '0100', ''' ''';

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