/**Begin D:\PDM_UPGRADE\PDM1\EB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_SCHEMECATALOG') 
CREATE TABLE T_EB_SCHEMECATALOG (
FID                  BIGINT               NOT NULL DEFAULT 0,
FMODIFIERID          BIGINT               NOT NULL DEFAULT 0,
FMODIFYTIME          DATETIME             NULL,
FLEVEL               INT                  NOT NULL DEFAULT 0,
FLONGNUMBER          NVARCHAR(255)        NOT NULL DEFAULT ' ',
FISLEAF              CHAR(1)              NOT NULL DEFAULT '0',
FNUMBER              NVARCHAR(255)        NOT NULL DEFAULT ' ',
FMODELID             BIGINT               NOT NULL DEFAULT 0,
FPARENTID            BIGINT               NOT NULL DEFAULT 0,
FMASTERID            BIGINT               NOT NULL DEFAULT 0
);
EXEC P_ALTERPK 'PK_T_EB_SCHEMECATALOG', 'T_EB_SCHEMECATALOG', 'FID', '1';
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SCHEMECATALOG_NUMBER') CREATE INDEX IDX_EB_SCHEMECATALOG_NUMBER ON T_EB_SCHEMECATALOG ( FNUMBER );
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SCHEMECATALOG_MODEL') CREATE INDEX IDX_EB_SCHEMECATALOG_MODEL ON T_EB_SCHEMECATALOG ( FMODELID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_DIMMEMBERMAPPING_L' AND KSQL_COL_NAME IN ('FFULLNAME')) 
 ALTER TABLE T_EB_DIMMEMBERMAPPING_L ADD (FFULLNAME NVARCHAR(100) DEFAULT ' ' );
 
  EXEC p_AlterColumn 'T_EB_DIMMEMBERMAPPING_L', 'FPKID', 'NVARCHAR(36)', 'NOT NULL', '0101', '0';
  
  EXEC p_AlterColumn 'T_EB_SCHEMEENTRY_L', 'FPKID', 'NVARCHAR(36)', 'NOT NULL', '0101', '0';

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