/**Begin D:\Users\rd_william_li\Documents\lipin\PDM\PDM_UPGRADE\pdm_new\BOS_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_BIZROLE' AND KSQL_COL_NAME IN ('FGROUPID')) 
 ALTER TABLE T_PERM_BIZROLE ADD (FGROUPID BIGINT DEFAULT 0 NOT NULL );


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PERM_BUSIROLEGROUP') 
 CREATE TABLE T_PERM_BUSIROLEGROUP (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FDESCRIPTION NVARCHAR(500) DEFAULT ' ' NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FLEVEL INT DEFAULT 0 NOT NULL,
FLONGNUMBER NVARCHAR(255) DEFAULT ' ' NOT NULL,
FISLEAF CHAR(1) DEFAULT '0' NOT NULL,
FFULLNAME NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PERM_BUSIROLEGROUP_L') 
 CREATE TABLE T_PERM_BUSIROLEGROUP_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(500) DEFAULT ' ' NOT NULL,
FFULLNAME NVARCHAR(500) DEFAULT ' ' NOT NULL
);





/**End D:\Users\rd_william_li\Documents\lipin\PDM\PDM_UPGRADE\pdm_new\BOS_table.sql **/
