/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BOS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PERM_APPBLACKLIST')
 CREATE TABLE T_PERM_APPBLACKLIST (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FISINCLUDESUBORG CHAR(1) DEFAULT '0' NOT NULL,
FAPPID VARCHAR(18) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_APPBLACKLIST' AND KSQL_COL_NAME ='FENABLE')
 ALTER TABLE T_PERM_APPBLACKLIST ADD (FENABLE CHAR(1) DEFAULT '1' NOT NULL );

 EXEC P_ALTERPK 'PK_T_PERM_APPBLACKLIST', 'T_PERM_APPBLACKLIST', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IX_PERM_APPBLACKLIST_ORGID') CREATE INDEX IX_PERM_APPBLACKLIST_ORGID ON T_PERM_APPBLACKLIST ( FORGID );
/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BOS_table.sql **/