/**Begin D:\tools\PDM_UPGRADE\pdm1\SYS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BAS_PICTURE_WHITE_LIST') 
 CREATE TABLE T_BAS_PICTURE_WHITE_LIST (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME DEFAULT GETDATE(),
FMODIFYTIME DATETIME DEFAULT GETDATE(),
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FWHITEENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BAS_PICTURE_WHITE_LIST_L') 
 CREATE TABLE T_BAS_PICTURE_WHITE_LIST_L (
FID BIGINT DEFAULT 0 NOT NULL,
FPKID NVARCHAR(36) DEFAULT ' ' NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BAS_PICTURE_WHITE_LIST_R3') 
 CREATE TABLE T_BAS_PICTURE_WHITE_LIST_R3 (
FID BIGINT DEFAULT 0 NOT NULL,
FREFSTATUS CHAR(1) DEFAULT '0' NOT NULL
);



/**End D:\tools\PDM_UPGRADE\pdm1\SYS_table.sql **/

/**Begin D:\tools\PDM_UPGRADE\pdm1\SYS_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_BAS_PICTURE_WHITE_LIST', 'T_BAS_PICTURE_WHITE_LIST', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_BAS_PICTURE_WHITE_LIST') CREATE INDEX IDX_T_BAS_PICTURE_WHITE_LIST ON T_BAS_PICTURE_WHITE_LIST ( FMASTERID );


 EXEC P_ALTERPK 'PK_T_BAS_PICTURE_WHITE_LIST_L', 'T_BAS_PICTURE_WHITE_LIST_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_BAS_PICTURE_WH_LIST_L') CREATE INDEX IDX_T_BAS_PICTURE_WH_LIST_L ON T_BAS_PICTURE_WHITE_LIST_L ( FID );


 EXEC P_ALTERPK 'PK_T_BAS_PICTURE_WHITE_LIST_R3', 'T_BAS_PICTURE_WHITE_LIST_R3', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_BAS_PICTURE_WH_LIST_R3') CREATE INDEX IDX_T_BAS_PICTURE_WH_LIST_R3 ON T_BAS_PICTURE_WHITE_LIST_R3 ( FREFSTATUS );



/**End D:\tools\PDM_UPGRADE\pdm1\SYS_constraint.sql **/

