/**BEGIN  **/


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_ANALYSISCANVAS') 
CREATE TABLE T_EB_ANALYSISCANVAS
(
    FID           BIGINT DEFAULT 0 NOT NULL,
    FNAME         NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FNUMBER       NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FDESCRIPTION  NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FTYPE         NVARCHAR(10) DEFAULT ' ' NOT NULL,
    FSTATUS       NVARCHAR(10) DEFAULT ' ' NOT NULL,
    FITEM         NCLOB,
    FPAGE         NCLOB,
	FCREATERID    BIGINT DEFAULT 0 NOT NULL,
	FCREATEDATE   DATETIME,
	FMODIFIERID   BIGINT DEFAULT 0 NOT NULL,
	FMODIFYDATE   DATETIME
);
-- 主键
EXEC P_ALTERPK 'PK_EB_ANALYSISCANVAS', 'T_EB_ANALYSISCANVAS', 'FID', '1';


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_ANALYSISCANVAS_DS') 
CREATE TABLE T_EB_ANALYSISCANVAS_DS
(
    FID              BIGINT DEFAULT 0 NOT NULL,
    FDATASET         BIGINT DEFAULT 0 NOT NULL,
    FANALYSISCUBENUM NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FANALYSISCUBEID  BIGINT DEFAULT 0 NOT NULL,
    FCANVASID        BIGINT DEFAULT 0 NOT NULL
);
-- 主键
EXEC P_ALTERPK 'PK_EB_ANALYSISCANVAS_DS', 'T_EB_ANALYSISCANVAS_DS', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_ANALYSISCANVAS_DS')
CREATE INDEX IDX_EB_ANALYSISCANVAS_DS ON T_EB_ANALYSISCANVAS_DS ( FCANVASID );


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_ANALYSISCANVAS_BOX') 
CREATE TABLE T_EB_ANALYSISCANVAS_BOX
(
    FID       BIGINT DEFAULT 0 NOT NULL,
    FNAME     NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FCANVASID BIGINT DEFAULT 0 NOT NULL,
    FTYPE     NVARCHAR(10) DEFAULT ' ' NOT NULL,
    FSTATUS   NVARCHAR(10) DEFAULT ' ' NOT NULL,
    FBSEQ     BIGINT DEFAULT 0 NOT NULL
);
-- 主键
EXEC P_ALTERPK 'PK_EB_ANALYSISCANVAS_BOX', 'T_EB_ANALYSISCANVAS_BOX', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_ANALYSISCANVAS_BOX')
CREATE INDEX IDX_EB_ANALYSISCANVAS_BOX ON T_EB_ANALYSISCANVAS_BOX ( FCANVASID );


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_ANALYSISCANVAS_DATA') 
CREATE TABLE T_EB_ANALYSISCANVAS_DATA
(
    FID       BIGINT DEFAULT 0 NOT NULL,
    FSANBOXID BIGINT DEFAULT 0 NOT NULL,
    FITEMID   NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FDATA     NCLOB
);
-- 主键
EXEC P_ALTERPK 'PK_EB_ANALYSISCANVAS_DATA', 'T_EB_ANALYSISCANVAS_DATA', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_ANALYSISCANVAS_DATA')
CREATE INDEX IDX_EB_ANALYSISCANVAS_DATA ON T_EB_ANALYSISCANVAS_DATA ( FSANBOXID );



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_ANALYSISCANVAS_COMM') 
CREATE TABLE T_EB_ANALYSISCANVAS_COMM
(
    FID         BIGINT DEFAULT 0 NOT NULL,
    FCANVASID   BIGINT DEFAULT 0 NOT NULL,
    FCOMMENT    NVARCHAR(200) DEFAULT ' ' NOT NULL,
	FCREATERID    BIGINT DEFAULT 0 NOT NULL,
	FCREATEDATE   DATETIME
);
-- 主键
EXEC P_ALTERPK 'PK_EB_ANALYSISCANVAS_COMM', 'T_EB_ANALYSISCANVAS_COMM', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_ANALYSISCANVAS_COMM')
CREATE INDEX IDX_EB_ANALYSISCANVAS_COMM ON T_EB_ANALYSISCANVAS_COMM ( FCANVASID );



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_ANALYSISCANVAS_CAT') 
CREATE TABLE T_EB_ANALYSISCANVAS_CAT
(
    FID         BIGINT DEFAULT 0 NOT NULL,
    FNAME       NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FNUMBER     NVARCHAR(50) DEFAULT ' ' NOT NULL,
	FCREATERID    BIGINT DEFAULT 0 NOT NULL,
	FCREATEDATE   DATETIME,
	FMODIFIERID   BIGINT DEFAULT 0 NOT NULL,
	FMODIFYDATE   DATETIME
);
-- 主键
EXEC P_ALTERPK 'PK_EB_ANALYSISCANVAS_CAT', 'T_EB_ANALYSISCANVAS_CAT', 'FID', '1';



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_ANALYSISCANVAS_IMG') 
CREATE TABLE T_EB_ANALYSISCANVAS_IMG
(
    FID           BIGINT DEFAULT 0 NOT NULL,
    FCATEID       BIGINT DEFAULT 0 NOT NULL,
    FNAME         NVARCHAR(50) DEFAULT ' ' NOT NULL,
    FFILEURL      NVARCHAR(200) DEFAULT ' ' NOT NULL,
    FPICTUREFIELD NVARCHAR(255) DEFAULT ' ' NOT NULL,
    FCREATERID    BIGINT DEFAULT 0 NOT NULL,
	FCREATEDATE   DATETIME,
	FMODIFIERID   BIGINT DEFAULT 0 NOT NULL,
	FMODIFYDATE   DATETIME
);
-- 主键
EXEC P_ALTERPK 'PK_EB_ANALYSISCANVAS_IMG', 'T_EB_ANALYSISCANVAS_IMG', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_ANALYSISCANVAS_IMG')
CREATE INDEX IDX_EB_ANALYSISCANVAS_IMG ON T_EB_ANALYSISCANVAS_IMG ( FCATEID );



/**END **/