/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BOS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BAS_MAINPAGELAYOUT' AND KSQL_COL_NAME ='FISMULTIORG') 
 ALTER TABLE T_BAS_MAINPAGELAYOUT ADD (FISMULTIORG CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PERM_CTRLTYPE_L') 
 CREATE TABLE T_PERM_CTRLTYPE_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID VARCHAR(18) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(36) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PERM_CTRLTYPE') 
 CREATE TABLE T_PERM_CTRLTYPE (
FID VARCHAR(18) DEFAULT ' ' NOT NULL,
FMASTERID VARCHAR(18) DEFAULT ' ' NOT NULL,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FSTATUS NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNUMBER NVARCHAR(60) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PERM_OPREXROLE') 
 CREATE TABLE T_PERM_OPREXROLE (
FID VARCHAR(18) DEFAULT ' ' NOT NULL,
FOPERATIONRULEOBJID VARCHAR(18) DEFAULT ' ' NOT NULL,
FROLEID VARCHAR(18) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PERM_OPREXUSRGRP') 
 CREATE TABLE T_PERM_OPREXUSRGRP (
FID VARCHAR(18) DEFAULT ' ' NOT NULL,
FOPERATIONRULEOBJID VARCHAR(18) DEFAULT ' ' NOT NULL,
FUSERGROUPID BIGINT DEFAULT 0 NOT NULL
);

  IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_CTRLTYPE' AND KSQL_COL_NAME ='FBIZOBJECTID') 
 ALTER TABLE T_PERM_CTRLTYPE ADD (FBIZOBJECTID VARCHAR(36) DEFAULT ' ' NOT NULL );


/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BOS_table.sql **/
