-- begin TMS_TERMINAL
create table TMS_TERMINAL (
    ID varchar(36) not null,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    TERMINAL_ID varchar(8) not null,
    MERCHANT_ID varchar(15) not null,
    MERCHANT_NAME1 varchar(20) not null,
    MERCHANT_NAME2 varchar(20),
    MERCHANT_NAME3 varchar(20),
    MERCHANT_PASSWORD varchar(6),
    ADMIN_PASSWORD varchar(6),
    INITIALISE_PASSWORD varchar(6),
    TIME_OF_SETTLEMENT integer,
    SETTLE_TIME1 varchar(4),
    SETTLE_TIME2 varchar(4),
    SETTLE_TIME3 varchar(4),
    PASSWORD_VOID boolean,
    PASSWORD_ADJUST boolean,
    PASSWORD_REFUND boolean,
    PASSWORD_OFFLINE boolean,
    PUSH_SETTLE_IN_DAYS integer,
    SETTLE_MAX_TRX_COUNT integer,
    SETTLE_PERIOD integer,
    SETTLE_ATTEMPT integer,
    PROFILE_ID varchar(36),
    AUTO_SETTLE boolean,
    TRACK2_TOP_UP_TUNAI varchar(40),
    REDEMPTION boolean,
    SMART_SPENDING boolean,
    LOYALTY_PURSE_ID1 varchar(10),
    LOYALTY_PURSE_ID2 varchar(10),
    LOYALTY_PURSE_ID3 varchar(10),
    EMV_INFORMATION boolean,
    CVM_ONLINE_PIN_BYPASS boolean,
    CVM_SIGN_PROMPT_PIN boolean,
    AUTO_INIT boolean,
    AUTO_INIT_NII varchar(255),
    CALL_CENTER1 varchar(255),
    CALL_CENTER2 varchar(255),
    IMPORT_DEFAULT boolean,
    --
    primary key (ID)
)^
-- end TMS_TERMINAL

-- begin TMS_APPLICATION
create table TMS_APPLICATION (
    ID varchar(36) not null,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    NAME varchar(50) not null,
    PACKAGE_NAME varchar(100) not null,
    APP_VERSION varchar(10),
    DESCRIPTION varchar(255),
    APK_ID varchar(36),
    CHANGELOG longvarchar,
    IMPORT_DEFAULT boolean,
    --
    primary key (ID)
)^
-- end TMS_APPLICATION

-- begin TMS_CAPK
create table TMS_CAPK (
    ID varchar(36) not null,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    NAME varchar(50) not null,
    IDX varchar(255) not null,
    RID varchar(10) not null,
    MODULUS longvarchar not null,
    EXPONENT varchar(4) not null,
    ALGO varchar(2) not null,
    HASH longvarchar not null,
    EXPIRY_DATE date,
    REMARK varchar(100),
    --
    primary key (ID)
)^
-- end TMS_CAPK
-- begin TMS_AID
create table TMS_AID (
    ID varchar(36) not null,
    VERSION integer not null,
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    NAME varchar(255) not null,
    TXN_TYPE varchar(8) not null,
    AID varchar(20) not null,
    AID_VERSION varchar(4) not null,
    TAC_DEFAULT varchar(10) not null,
    TAC_DENIAL varchar(10) not null,
    TAC_ONLINE varchar(10) not null,
    THRESHOLD varchar(12) not null,
    TARGET_PERCENTAGE varchar(4) not null,
    MAX_TARGET_PERCENTAGE varchar(4) not null,
    DDOL longvarchar not null,
    TDOL longvarchar not null,
    FLOOR_LIMIT varchar(8) not null,
    APP_SELECT varchar(2) not null,
    AID_PRIORITY varchar(2) not null,
    TRX_TYPE9C varchar(2) not null,
    CATEGORY_CODE varchar(2) not null,
    CL_KERNEL_TO_USE varchar(4),
    CL_OPTIONS varchar(8),
    CL_TRX_LIMIT varchar(12),
    CL_CVM_LIMIT varchar(12),
    CL_FLOOR_LIMIT varchar(12),
    REMARK varchar(100),
    --
    primary key (ID)
)^
-- end TMS_AID
-- begin TMS_CARD
create table TMS_CARD (
    ID varchar(36) not null,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    NAME varchar(100) not null,
    BIN_RANGE_START varchar(10) not null,
    BIN_RANGE_END varchar(10) not null,
    CARD_NUM_LENGTH integer not null,
    PAN_DIGIT_UNMASKING varchar(20) not null,
    PRINT_CARDHOLDER_COPY boolean,
    PRINT_MERCHANT_COPY boolean,
    PRINT_BANK_COPY boolean,
    PIN_LENGTH integer,
    PIN_PROMPT boolean,
    --
    primary key (ID)
)^
-- end TMS_CARD
-- begin TMS_ISSUER
create table TMS_ISSUER (
    ID varchar(36) not null,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    NAME varchar(30) not null,
    ISSUER_ID varchar(10) not null,
    CAPTURE_TRANS boolean,
    PRINT_RECEIPT boolean,
    ACCOUNT_SELECT boolean,
    PIN_ENTRY boolean,
    CHECK_MOD10 boolean,
    CHECK_EXP_DATE boolean,
    MANUAL_PAN_ENTRY boolean,
    ENABLE_OFFLINE boolean,
    ENABLE_ADJUST boolean,
    DISABLE_REFUND boolean,
    DISABLE_CARD_VER boolean,
    DISABLE_VOID boolean,
    DISABLE_REWARD boolean,
    DISABLE_INSTALLMENT boolean,
    DISABLE_CASH boolean,
    DISABLE_AUTH boolean,
    DISABLE_BALANCE_INQUIRY boolean,
    BALANCE_INQUIRY_SLIP boolean,
    DISABLE_POINT_BAL_INQ boolean,
    ENABLE_PRINT_POINT_BAL boolean,
    AUTO_CALCULATION boolean,
    ON_US boolean,
    INQ_SALDO boolean,
    CASH_WITHDRAWAL boolean,
    TRANSFER_BNI boolean,
    TRANSFER_ANTAR_BANK boolean,
    REG_E_CHANNEL boolean,
    PAYMENT_TELKOM boolean,
    PULSA_TELKOMSEL boolean,
    BPJS_KESEHATAN boolean,
    BNI_CC_PAYMENT boolean,
    TAPCASH_TOPUP boolean,
    CASH_DEPOSIT boolean,
    IMIGRASI boolean,
    PAJAK_PNBP_BEA_CUKAI boolean,
    INTEREST varchar(10),
    FLOOR_LIMIT varchar(10),
    TIP_ADJUST varchar(10),
    DEFAULT_ACCOUNT varchar(2),
    ACQUIRER_ID varchar(36),
    --
    primary key (ID)
)^
-- end TMS_ISSUER
-- begin TMS_ACQUIRER
create table TMS_ACQUIRER (
    ID varchar(36) not null,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    NAME varchar(30) not null,
    HOST_ID varchar(3),
    NUMBER_OF_PRINT integer,
    RESP_TIMEOUT integer,
    FORCE_SETTLE_DAYS integer,
    FORCE_SETTLE_TM_COUNT integer,
    ACQUIRER_ID varchar(2),
    HOST_DESTINATION_ADDR varchar(100),
    HOST_DESTINATION_PORT varchar(6),
    SHOW_PRINT_EXP_DATE boolean,
    TLE_ACQUIRER boolean,
    TLE_SETTING_ID varchar(36),
    MASTER_KEY_LOCATION varchar(4),
    MASTER_KEY longvarchar,
    WORKING_KEY longvarchar,
    ACQUIRER_TYPE varchar(50) not null,
    _TERMINAL_ID varchar(36),
    BATCH_NUMBER varchar(6),
    MERCHANT_ID varchar(15),
    TERMINAL_ID varchar(8),
    --
    primary key (ID)
)^
-- end TMS_ACQUIRER
-- begin TMS_PROFILE
create table TMS_PROFILE (
    ID varchar(36) not null,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    CODE varchar(15) not null,
    NAME varchar(30) not null,
    TERMINAL_ID varchar(36),
    NOTE varchar(30),
    --
    primary key (ID)
)^
-- end TMS_PROFILE
-- begin TMS_TLE_SETTING
create table TMS_TLE_SETTING (
    ID varchar(36) not null,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    TLE_EFT_SEC varchar(10) not null,
    TLE_ID varchar(2) not null,
    ACQUIRER_ID varchar(3) not null,
    LTMK_AID varchar(3) not null,
    VENDOR_ID varchar(8) not null,
    TLE_VER varchar(1) not null,
    KMS_SECURE_NII varchar(4),
    EDC_SECURE_NII varchar(4),
    CAPK_EXPONENT varchar(2),
    CAPK_LENGTH integer,
    CAPK_VALUE longvarchar,
    AID_LENGTH integer,
    AID_VALUE longvarchar,
    FIELD_ENCRYPTED1 varchar(3),
    FIELD_ENCRYPTED2 varchar(3),
    FIELD_ENCRYPTED3 varchar(3),
    FIELD_ENCRYPTED4 varchar(3),
    FIELD_ENCRYPTED5 varchar(3),
    FIELD_ENCRYPTED6 varchar(3),
    --
    primary key (ID)
)^
-- end TMS_TLE_SETTING
-- begin TMS_DEVICE
create table TMS_DEVICE (
    ID varchar(36) not null,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    IMEI varchar(40) not null,
    SN varchar(40) not null,
    BRAND varchar(100) not null,
    MODEL varchar(50) not null,
    MANUFACTURER varchar(255) not null,
    IMPORT_DEFAULT boolean,
    --
    primary key (ID)
)^
-- end TMS_DEVICE
-- begin TMS_TERMINAL_USER
create table TMS_TERMINAL_USER (
    ID varchar(36) not null,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    TERMINAL_ID varchar(36),
    USERNAME varchar(255) not null,
    --
    primary key (ID)
)^
-- end TMS_TERMINAL_USER
-- begin TMS_DEVICE_TERMINAL
create table TMS_DEVICE_TERMINAL (
    ID varchar(36) not null,
    VERSION integer not null,
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    --
    DEVICE_ID varchar(36) not null,
    TERMINAL_ID varchar(36) not null,
    --
    primary key (ID)
)^
-- end TMS_DEVICE_TERMINAL
-- begin TMS_DEVICE_LOCATION
create table TMS_DEVICE_LOCATION (
    ID varchar(36) not null,
    --
    DEVICE_ID varchar(36),
    LAT double precision,
    LON double precision,
    LOG_TIME timestamp,
    --
    primary key (ID)
)^
-- end TMS_DEVICE_LOCATION
-- begin TMS_PUBLIC_KEY_SETTING
create table TMS_PUBLIC_KEY_SETTING (
    ID varchar(36) not null,
    VERSION integer not null,
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    --
    IDX varchar(5) not null,
    RID varchar(10) not null,
    MODULUS longvarchar not null,
    EXPONENT varchar(2) not null,
    HASH longvarchar not null,
    ALGO varchar(2) not null,
    --
    primary key (ID)
)^
-- end TMS_PUBLIC_KEY_SETTING
-- begin TMS_APPLICATION_THIRD_PARTY
create table TMS_APPLICATION_THIRD_PARTY (
    ID varchar(36) not null,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    NAME varchar(50) not null,
    PACKAGE_NAME varchar(100) not null,
    APP_VERSION varchar(10),
    DESCRIPTION varchar(255),
    APK_ID varchar(36),
    CHANGELOG longvarchar,
    IMPORT_DEFAULT boolean,
    --
    primary key (ID)
)^
-- end TMS_APPLICATION_THIRD_PARTY
-- begin TMS_ISSUER_CARD_DELETE_HISTORY
create table TMS_ISSUER_CARD_DELETE_HISTORY (
    ID varchar(36) not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    --
    ISSUER_ID varchar(36) not null,
    CARD_ID varchar(36) not null,
    FLAG varchar(1) not null,
    PIN_PROMPT boolean,
    --
    primary key (ID)
)^
-- end TMS_ISSUER_CARD_DELETE_HISTORY
-- begin TMS_APPLICATION_INTENT
create table TMS_APPLICATION_INTENT (
    ID varchar(36) not null,
    VERSION integer not null,
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    --
    NAME varchar(255) not null,
    DESCRIPTION varchar(100),
    APPLICATION_ID varchar(36),
    ICON_ID varchar(36),
    --
    primary key (ID)
)^
-- end TMS_APPLICATION_INTENT
-- begin TMS_LAUNCHER_SETTING
create table TMS_LAUNCHER_SETTING (
    ID varchar(36) not null,
    VERSION integer not null,
    CREATE_TS timestamp,
    CREATED_BY varchar(50),
    UPDATE_TS timestamp,
    UPDATED_BY varchar(50),
    DELETE_TS timestamp,
    DELETED_BY varchar(50),
    --
    CODE varchar(20) not null,
    NAME varchar(50) not null,
    GENERAL_PASSWORD varchar(20) not null,
    ROOT_PASSWORD varchar(20) not null,
    SHOW_MENU boolean not null,
    MAIN_BANNER_IMAGE_ID varchar(36),
    BACKGROUND_COLOR varchar(7),
    TICKER_TEXT varchar(255),
    --
    primary key (ID)
)^
-- end TMS_LAUNCHER_SETTING
-- begin TMS_ISSUER_CARD_LINK
create table TMS_ISSUER_CARD_LINK (
    ISSUER_ID varchar(36) not null,
    CARD_ID varchar(36) not null,
    primary key (ISSUER_ID, CARD_ID)
)^
-- end TMS_ISSUER_CARD_LINK
-- begin TMS_PROFILE_APPLICATION_THIRD_PARTY_LINK
create table TMS_PROFILE_APPLICATION_THIRD_PARTY_LINK (
    APPLICATION_THIRD_PARTY_ID varchar(36) not null,
    PROFILE_ID varchar(36) not null,
    primary key (APPLICATION_THIRD_PARTY_ID, PROFILE_ID)
)^
-- end TMS_PROFILE_APPLICATION_THIRD_PARTY_LINK
-- begin TMS_PROFILE_APPLICATION_LINK
create table TMS_PROFILE_APPLICATION_LINK (
    APPLICATION_ID varchar(36) not null,
    PROFILE_ID varchar(36) not null,
    primary key (APPLICATION_ID, PROFILE_ID)
)^
-- end TMS_PROFILE_APPLICATION_LINK
-- begin TMS_PROFILE_APPLICATION_INTENT_LINK
create table TMS_PROFILE_APPLICATION_INTENT_LINK (
    PROFILE_ID varchar(36) not null,
    APPLICATION_INTENT_ID varchar(36) not null,
    primary key (PROFILE_ID, APPLICATION_INTENT_ID)
)^
-- end TMS_PROFILE_APPLICATION_INTENT_LINK
