create table if not exists dids
(
    did text primary key
);

create table if not exists operations
(
    did        text        not null references dids (did),
    hash       text        not null,
    prev       text,
    sig        text        not null,
    nullified  bool        not null default false,

    operation  jsonb       not null,

    created_at timestamptz not null default now(),

    primary key (did, hash)
);

create index if not exists operations_created on operations (created_at);
create index if not exists operations_nullified on operations (nullified);