
    create table IDENT_EXTSESSIONS (
       ID int8 generated by default as identity,
        TOKEN_ISSUER varchar(256) not null,
        SESSION_ID varchar(64) not null,
        EXTSTATE varchar(4000) not null,
        primary key (ID)
    );

    create table IDENT_SESSIONS (
       SESSION_ID varchar(64) not null,
        CREATED_AT timestamp,
        IDENTITY_DATA varchar(10485760),
        IDENTITY_HASH varchar(512),
        LAST_USED_AT timestamp,
        primary key (SESSION_ID)
    );

    create table IDENT_TOKENS (
       TOKEN_KEY varchar(1024) not null,
        CREATED_AT timestamp,
        TOKEN_VALUE varchar(10485760) not null,
        EXPIRES_AT timestamp,
        TOKEN_ISSUER varchar(256) not null,
        SESSION_ID varchar(64) not null,
        TOKEN_TYPE int4 not null,
        primary key (TOKEN_KEY)
    );
create index ident_extsessions_state_idx on IDENT_EXTSESSIONS (EXTSTATE);
create index ident_extsessions_session_idx on IDENT_EXTSESSIONS (SESSION_ID);
create index ident_extsessions_issuer_idx on IDENT_EXTSESSIONS (TOKEN_ISSUER);
create index ident_sessions_createdat_idx on IDENT_SESSIONS (CREATED_AT);
create index ident_sessions_lastuseat_idx on IDENT_SESSIONS (LAST_USED_AT);
create index ident_tokens_sessionid_idx on IDENT_TOKENS (SESSION_ID);
create index ident_tokens_issuer_idx on IDENT_TOKENS (TOKEN_ISSUER);
create index ident_tokens_type_idx on IDENT_TOKENS (TOKEN_TYPE);
create index ident_tokens_createdat_idx on IDENT_TOKENS (CREATED_AT);
create index ident_tokens_expiresat_idx on IDENT_TOKENS (EXPIRES_AT);
create index ident_tokens_latest_idx on IDENT_TOKENS (SESSION_ID, TOKEN_ISSUER, TOKEN_TYPE, EXPIRES_AT);
