
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 't_privacy_task' AND KSQL_COL_NAME ='ftasknumber') 
ALTER TABLE t_privacy_task ADD ftasknumber VARCHAR(50);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 't_privacy_task' AND KSQL_COL_NAME ='fentityname') 
ALTER TABLE t_privacy_task ADD fentityname VARCHAR(50);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 't_privacy_task' AND KSQL_COL_NAME ='ffieldident') 
ALTER TABLE t_privacy_task ADD ffieldident VARCHAR(50);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 't_privacy_task' AND KSQL_COL_NAME ='ffielddesc') 
ALTER TABLE t_privacy_task ADD ffielddesc VARCHAR(50);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 't_privacy_task' AND KSQL_COL_NAME ='fcreater') 
ALTER TABLE t_privacy_task ADD fcreater bigint;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 't_privacy_data_tag' AND KSQL_COL_NAME ='fmodifier') 
ALTER TABLE t_privacy_data_tag ADD fmodifier bigint;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 't_privacy_data_tag' AND KSQL_COL_NAME ='fmodifydate') 
ALTER TABLE t_privacy_data_tag ADD fmodifydate datetime;


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_privacy_encrypt_scheme') 
create table t_privacy_encrypt_scheme
(
    fid           bigint  not null,
    fdatacenterid VARCHAR(200) DEFAULT ' ' not null,
    ftenantid     VARCHAR(200) DEFAULT ' ' not null,
    fworksecretid VARCHAR(200) DEFAULT ' ' not null,
    falgorithm    VARCHAR(200) DEFAULT ' ' not null,
    fname         VARCHAR(200) DEFAULT ' ' not null,
    fdesc         VARCHAR(200),
	CONSTRAINT t_privacy_encrypt_scheme_pkey PRIMARY KEY (fid)
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 't_privacy_scheme_config' AND KSQL_COL_NAME ='fcreater') 
ALTER TABLE t_privacy_scheme_config ADD fcreater bigint;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 't_privacy_scheme_config' AND KSQL_COL_NAME ='fcreatedate') 
ALTER TABLE t_privacy_scheme_config ADD fcreatedate datetime;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 't_privacy_scheme_config' AND KSQL_COL_NAME ='fmodifier') 
ALTER TABLE t_privacy_scheme_config ADD fmodifier bigint;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 't_privacy_scheme_config' AND KSQL_COL_NAME ='fmodifydate') 
ALTER TABLE t_privacy_scheme_config ADD fmodifydate datetime;

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 't_privacy_scheme_encrypt' AND KSQL_COL_NAME ='fencrypt_schemeid') 
alter table t_privacy_scheme_encrypt add fencrypt_schemeid bigint;


