IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_STOREKEEPER' AND KSQL_COL_NAME ='FMANAGE_DIMENSION')
 ALTER TABLE T_FA_STOREKEEPER ADD (FMANAGE_DIMENSION VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_FA_STOREKEEPER' AND KSQL_COL_NAME ='FROLE')
 ALTER TABLE T_FA_STOREKEEPER ADD (FROLE CHAR(1) DEFAULT '1' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_ORGMANAGERS')
 CREATE TABLE T_FA_ORGMANAGERS (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_ASSETMANAGER_ENTRY')
 CREATE TABLE T_FA_ASSETMANAGER_ENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FMANAGERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_MANAGE_ASSETCAT')
 CREATE TABLE T_FA_MANAGE_ASSETCAT (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_MANAGE_USEDEPT')
 CREATE TABLE T_FA_MANAGE_USEDEPT (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_MANAGE_MGTDEPT')
 CREATE TABLE T_FA_MANAGE_MGTDEPT (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_WARN_SETTING')
 CREATE TABLE T_FA_WARN_SETTING (
FID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_WARNENTRY')
 CREATE TABLE T_FA_WARNENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FASSETCATEGORYID BIGINT DEFAULT 0 NOT NULL,
FBASIS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCONDITION NVARCHAR(50) DEFAULT ' ' NOT NULL,
FVALUE INT DEFAULT 0 NOT NULL
);