/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYS_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PRIVACY_TRANSDATATAG' AND KSQL_COL_NAME ='FDESENRULEID') 
 ALTER TABLE T_PRIVACY_TRANSDATATAG ADD (FDESENRULEID VARCHAR(36) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PRIVACY_BLACKFIELDINFO_L') 
 CREATE TABLE T_PRIVACY_BLACKFIELDINFO_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PRIVACY_DATA_FIELD_TPL_L') 
 CREATE TABLE T_PRIVACY_DATA_FIELD_TPL_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FENTITY_NAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FAPP_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCLOUD_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FFIELD_DESC NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PRIVACY_DESEN_TPL_L') 
 CREATE TABLE T_PRIVACY_DESEN_TPL_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FDENSE_FIELD_DESC NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDENSE_ENTITY_NAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FDENSE_APP_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDENSE_CLOUD_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PRIVACY_ENCRYPT_TPL_L') 
 CREATE TABLE T_PRIVACY_ENCRYPT_TPL_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FENCRYPT_FIELD_DESC NVARCHAR(100) DEFAULT ' ' NOT NULL,
FENCRYPT_ENTITY_NAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FENCRYPT_APP_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FENCRYPT_CLOUD_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PRIVACY_DATA_TAG_FIELDS_L') 
 CREATE TABLE T_PRIVACY_DATA_TAG_FIELDS_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FENTITY_NAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FAPP_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCLOUD_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FFIELD_DESC NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PRIVACY_DESEN_AUTHORITY_L') 
 CREATE TABLE T_PRIVACY_DESEN_AUTHORITY_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FFIELDNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FENTITYNAME NVARCHAR(200) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PRIVACY_SCHEME_DESEN_L') 
 CREATE TABLE T_PRIVACY_SCHEME_DESEN_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FDENSE_FIELD_DESC NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDENSE_ENTITY_NAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FDENSE_APP_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDENSE_CLOUD_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PRIVACY_SCHEME_ENCRYPT_L') 
 CREATE TABLE T_PRIVACY_SCHEME_ENCRYPT_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FENCRYPT_FIELD_DESC NVARCHAR(100) DEFAULT ' ' NOT NULL,
FENCRYPT_ENTITY_NAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FENCRYPT_APP_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FENCRYPT_CLOUD_NAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PRIVACY_TASK_L') 
 CREATE TABLE T_PRIVACY_TASK_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FFIELDDESC NVARCHAR(100) DEFAULT ' ' NOT NULL,
FENTITYNAME NVARCHAR(200) DEFAULT ' ' NOT NULL
);



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