-- Add migration script here
-- The transaction's blueprint to be checked on each request
create table transaction_schema (
    -- The transaction type
    type text not null,
    -- The schema's version (to allow for multiple revisions - maybe)
    version varchar not null,
    -- Actual JSON schema
    json_schema jsonb not null,
    created_at timestamptz not null default now(),
    updated_at timestamptz not null default now(),
    primary key (type, version)
);

create trigger update_transaction_schema_modtime
    before update on transaction_schema
    for each row
    execute function update_updated_at_column();
