
    
    create table IDENT_EXTSESSIONS (
       ID bigint identity not null,
        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 datetime2,
        IDENTITY_DATA varchar(MAX),
        IDENTITY_HASH varchar(512),
        LAST_USED_AT datetime2,
        primary key (SESSION_ID)
    );

    create table IDENT_TOKENS (
       TOKEN_KEY varchar(1024) not null,
        CREATED_AT datetime2,
        TOKEN_VALUE varchar(MAX) not null,
        EXPIRES_AT datetime2,
        TOKEN_ISSUER varchar(256) not null,
        SESSION_ID varchar(64) not null,
        TOKEN_TYPE int 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);
