IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_BARCODE_UPGRADE_REC')
CREATE TABLE T_FA_BARCODE_UPGRADE_REC (
    FID BIGINT DEFAULT 0 NOT NULL,
    FENTRYID BIGINT DEFAULT 0 NOT NULL,
    FSEQ INT DEFAULT 0 NOT NULL,
    FREALCARDID BIGINT DEFAULT 0 NOT NULL,
    FOLDBARCODE VARCHAR(50) DEFAULT ' ' NOT NULL,
    FNEWBARCODE VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_FA_BARCODE_UPGRADE_LOG')
CREATE TABLE T_FA_BARCODE_UPGRADE_LOG (
    FID BIGINT DEFAULT 0 NOT NULL,
    FOPERATORID BIGINT DEFAULT 0 NOT NULL,
    FSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
    FERRMSG VARCHAR(255) DEFAULT ' ' NOT NULL,
    FERRMSG_TAG NCLOB,
    FSTARTDATE DATETIME,
    FENDDATE DATETIME,
    FUPGRADEPARAM VARCHAR(255) DEFAULT ' ' NOT NULL,
    FUPGRADEPARAM_TAG NCLOB,
    TRACEID VARCHAR(50) DEFAULT ' ' NOT NULL
);