CREATE TABLE IF NOT EXISTS FIDO2_DEVICE_STORE (
            TENANT_ID INTEGER,
            DOMAIN_NAME VARCHAR(255) NOT NULL,
            USER_NAME VARCHAR(45) NOT NULL,
            TIME_REGISTERED TIMESTAMP,
            USER_HANDLE VARCHAR(200) NOT NULL,
            CREDENTIAL_ID VARCHAR(200) NOT NULL,
            PUBLIC_KEY_COSE VARCHAR(2048) NOT NULL,
            SIGNATURE_COUNT BIGINT,
            USER_IDENTITY VARCHAR(200) NOT NULL,
            PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME, USER_HANDLE));

CREATE TABLE IF NOT EXISTS IDN_AUTH_SESSION_APP_INFO (
            SESSION_ID VARCHAR (100) NOT NULL,
            SUBJECT VARCHAR (100) NOT NULL,
            APP_ID INTEGER NOT NULL,
            INBOUND_AUTH_TYPE VARCHAR (255) NOT NULL,
            PRIMARY KEY (SESSION_ID, SUBJECT, APP_ID, INBOUND_AUTH_TYPE));

CREATE TABLE IF NOT EXISTS IDN_AUTH_SESSION_META_DATA (
            SESSION_ID VARCHAR (100) NOT NULL,
            PROPERTY_TYPE VARCHAR (100) NOT NULL,
            VALUE VARCHAR (255) NOT NULL,
            PRIMARY KEY (SESSION_ID, PROPERTY_TYPE, VALUE));

CREATE TABLE IF NOT EXISTS IDN_FUNCTION_LIBRARY (
            NAME VARCHAR(255) NOT NULL,
            DESCRIPTION VARCHAR(1023),
            TYPE VARCHAR(255) NOT NULL,
            TENANT_ID INTEGER NOT NULL,
            DATA BLOB NOT NULL,
            PRIMARY KEY (TENANT_ID,NAME));

CREATE INDEX IF NOT EXISTS IDX_FIDO2_STR ON FIDO2_DEVICE_STORE(USER_NAME, TENANT_ID, DOMAIN_NAME, CREDENTIAL_ID, USER_HANDLE);
