/**Begin D:\willian\PDM_UPGRADE\PDM1\EB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_PARAM_TREE') 
 CREATE TABLE T_EB_PARAM_TREE (
FID BIGINT DEFAULT 0 NOT NULL,
FCODE NVARCHAR(32) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(64) DEFAULT ' ' NOT NULL,
FFORMID NVARCHAR(32) DEFAULT ' ' NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_PARAM_SETTING') 
 CREATE TABLE T_EB_PARAM_SETTING (
FID BIGINT DEFAULT 0 NOT NULL,
FNODEID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FPARAMS NCLOB DEFAULT ' ',
FCREATEDATE DATETIME,
FMODIFYDATE DATETIME
);

EXEC P_ALTERPK 'PK_T_EB_PARAM_TREE', 'T_EB_PARAM_TREE', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_PARAM_TREE') CREATE UNIQUE INDEX IDX_EB_PARAM_TREE ON T_EB_PARAM_TREE ( FCODE );

EXEC P_ALTERPK 'PK_T_EB_PARAM_SETTING', 'T_EB_PARAM_SETTING', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_PARAM_SETTING') CREATE UNIQUE INDEX IDX_EB_PARAM_SETTING ON T_EB_PARAM_SETTING ( FNODEID ,FMODELID );

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