/**Begin D:\Users\rd_william_li\Documents\lipin\PDM\PDM_UPGRADE\PDM_UPGRADE\pdm_new\BOS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_ADMINGROUP' AND KSQL_COL_NAME IN ('FISDOMAIN')) 
 ALTER TABLE T_PERM_ADMINGROUP ADD (FISDOMAIN CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_ADMINGROUP' AND KSQL_COL_NAME IN ('FDOMAINID')) 
 ALTER TABLE T_PERM_ADMINGROUP ADD (FDOMAINID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PERM_ADMINDOMAIN') 
 CREATE TABLE T_PERM_ADMINDOMAIN (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCLOUDID VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT '0' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PERM_ADMINDOMAINRANGE') 
 CREATE TABLE T_PERM_ADMINDOMAINRANGE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FAPPID VARCHAR(18) DEFAULT ' ' NOT NULL,
FENTITYNUM VARCHAR(36) DEFAULT ' ' NOT NULL,
FPERMITEMID VARCHAR(18) DEFAULT ' ' NOT NULL
);



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