-- 创建方案分配表索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SCHEMEASSIGN_V') 
CREATE INDEX IDX_EB_SCHEMEASSIGN_V ON T_EB_SCHEMEASSIGN (FVERSIONID);


IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SCHEMEASSIGN_D') 
CREATE INDEX IDX_EB_SCHEMEASSIGN_D ON T_EB_SCHEMEASSIGN (FDATATYPEID);


-- 任务下达索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TASKSAVE_TASK') 
CREATE INDEX IDX_EB_TASKSAVE_TASK ON T_EB_TASKSAVE (FTASKID);


-- 引用关系表增加成员视图id字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_MEMBERQUOTEENTRY' AND KSQL_COL_NAME IN ('FVIEWID')) 
ALTER TABLE T_EB_MEMBERQUOTEENTRY ADD (FVIEWID BIGINT NOT NULL DEFAULT 0);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_MEMBERQUOTEENTRY' AND KSQL_COL_NAME IN ('FEXT')) 
ALTER TABLE T_EB_MEMBERQUOTEENTRY ADD (FEXT NVARCHAR(256));
 

