IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_privacy_data_tag_tpl') 
CREATE TABLE t_privacy_data_tag_tpl (
	fid bigint NOT NULL,
	fnumber varchar(10) NOT NULL DEFAULT ' ',
	fname varchar(10) NOT NULL DEFAULT ' ',
	fcreater bigint,
	fcreatedate datetime,
	fstatus varchar(50) NOT NULL DEFAULT ' ',
	fmodifier bigint,
	fmodifydate datetime,
	CONSTRAINT pk_privacy_data_tag_tpl PRIMARY KEY (fid)
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_privacy_data_tag_tpl_r3') 
CREATE TABLE t_privacy_data_tag_tpl_r3 (
	fid bigint NOT NULL DEFAULT 0,
	frefstatus CHAR(1) NOT NULL DEFAULT '0',
	CONSTRAINT pk_privacy_data_tag_tpl_r3 PRIMARY KEY (fid)
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_privacy_data_tag_tpl_l') 
CREATE TABLE t_privacy_data_tag_tpl_l (
	fpkid varchar(36) NOT NULL,
	fid bigint NOT NULL DEFAULT 0,
	flocaleid varchar(10) NOT NULL DEFAULT '',
	fname varchar(10) NOT NULL DEFAULT ' ',
	CONSTRAINT pk_privacy_data_tag_tpl_l PRIMARY KEY (fpkid)
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_privacy_data_field_tpl') 
CREATE TABLE t_privacy_data_field_tpl (
	fid bigint NOT NULL,
	fentryid bigint NOT NULL,
	fseq integer NOT NULL DEFAULT 0,
	ffield_ident varchar(50) NOT NULL DEFAULT ' ',
	ffield_desc varchar(50) NOT NULL DEFAULT ' ',
	fentity_name varchar(50) NOT NULL DEFAULT ' ',
	fapp_name varchar(50) NOT NULL DEFAULT ' ',
	ffield_type varchar(50) NOT NULL DEFAULT ' ',
	fcloud_name varchar(50) NOT NULL DEFAULT ' ',
	ffield_name varchar(50) NOT NULL DEFAULT ' ',
	ftable_name varchar(50) NOT NULL DEFAULT ' ',
	fcloud_number varchar(50) NOT NULL DEFAULT ' ',
	fapp_number varchar(50) NOT NULL DEFAULT ' ',
	fentity_number varchar(50) NOT NULL DEFAULT ' ',
	fapp_route varchar(50) NOT NULL DEFAULT ' ',
	fdatatagid bigint,
	CONSTRAINT pk_privacy_data_field_tpl PRIMARY KEY (fentryid)
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_privacy_config_tpl') 
CREATE TABLE t_privacy_config_tpl (
	fid bigint NOT NULL,
	fmasterid bigint,
	fscheme_code varchar(10) NOT NULL DEFAULT ' ',
	fscheme_name varchar(10) NOT NULL DEFAULT ' ',
	fscheme_desc varchar(50) NOT NULL DEFAULT ' ',
	fdatalabelid bigint,
	fmessagechannel varchar(50) NOT NULL DEFAULT ' ',
	ftemplate varchar(255) NOT NULL DEFAULT ' ',
	fcreatedate datetime,
	fmodifydate datetime,
	fmodifier bigint,
	fcreater bigint,
	fscheme_status varchar(50) NOT NULL DEFAULT ' ',
	CONSTRAINT pk_privacy_config_tpl PRIMARY KEY (fid)
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_privacy_config_tpl_l') 
CREATE TABLE t_privacy_config_tpl_l (
	fpkid varchar(36) NOT NULL,
	fid bigint NOT NULL DEFAULT 0,
	flocaleid varchar(10) NOT NULL DEFAULT '',
	fscheme_name varchar(10) NOT NULL DEFAULT ' ',
	CONSTRAINT pk_privacy_config_tpl_l PRIMARY KEY (fpkid)
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_privacy_config_tpl_r3') 
CREATE TABLE t_privacy_config_tpl_r3 (
	fid bigint NOT NULL DEFAULT 0,
	frefstatus CHAR(1) NOT NULL DEFAULT '0',
	CONSTRAINT pk_privacy_config_tpl_r3 PRIMARY KEY (fid)
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_privacy_encrypt_tpl') 
CREATE TABLE t_privacy_encrypt_tpl (
	fid bigint NOT NULL,
	fentryid bigint NOT NULL,
	fseq integer NOT NULL DEFAULT 0,
	fencrypt_cloud_number varchar(50) NOT NULL DEFAULT ' ',
	fencrypt_entity_number varchar(50) NOT NULL DEFAULT ' ',
	fencrypt_app_number varchar(50) NOT NULL DEFAULT ' ',
	fencrypt_field_ident varchar(50) NOT NULL DEFAULT ' ',
	fencrypt_field_desc varchar(60) NOT NULL DEFAULT ' ',
	fencrypt_algorithm varchar(50) NOT NULL DEFAULT ' ',
	fversion bigint,
	fencrypt_table_name varchar(50) NOT NULL DEFAULT ' ',
	fencrypt_field_name varchar(50) NOT NULL DEFAULT ' ',
	fencrypt_field_type varchar(50) NOT NULL DEFAULT ' ',
	fencrypt_entity_name varchar(50) NOT NULL DEFAULT ' ',
	fencrypt_app_name varchar(50) NOT NULL DEFAULT ' ',
	fencrypt_cloud_name varchar(50) NOT NULL DEFAULT ' ',
	fapp_route varchar(50) NOT NULL DEFAULT ' ',
	fencrypt_status varchar(50) NOT NULL DEFAULT ' ',
	flabelid bigint,
	fencrypt_schemeid bigint,
	CONSTRAINT pk_privacy_encrypt_tpl PRIMARY KEY (fentryid)
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 't_privacy_desen_tpl') 
CREATE TABLE t_privacy_desen_tpl (
	fid bigint NOT NULL,
	fentryid bigint NOT NULL,
	fseq integer NOT NULL DEFAULT 0,
	fdense_entity_number varchar(50) NOT NULL DEFAULT ' ',
	fdense_app_number varchar(50) NOT NULL DEFAULT ' ',
	fdense_cloud_number varchar(50) NOT NULL DEFAULT ' ',
	fdense_field_ident varchar(50) NOT NULL DEFAULT ' ',
	fdense_field_name varchar(50) NOT NULL DEFAULT ' ',
	fdesensitize_rule varchar(50) NOT NULL DEFAULT ' ',
	fdensefieldlocale varchar(50) NOT NULL DEFAULT ' ',
	fdense_field_type varchar(50) NOT NULL DEFAULT ' ',
	fdesensitize_type varchar(50) NOT NULL DEFAULT ' ',
	fplugin varchar(50) NOT NULL DEFAULT ' ',
	fdense_table_name varchar(50) NOT NULL DEFAULT ' ',
	fdense_field_desc varchar(60) NOT NULL DEFAULT ' ',
	fdense_entity_name varchar(50) NOT NULL DEFAULT ' ',
	fdense_app_name varchar(50) NOT NULL DEFAULT ' ',
	fdense_cloud_name varchar(50) NOT NULL DEFAULT ' ',
	fdesensitiz_status varchar(50) NOT NULL DEFAULT ' ',
	flabelid bigint,
	fdense_field_locale varchar(50) DEFAULT ' ' NOT NULL,
	CONSTRAINT pk_privacy_desen_tpl PRIMARY KEY (fentryid)
);