CREATE TABLE IF NOT EXISTS qfixpt_messages (
    id          UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    trade_id    TEXT NOT NULL,
    j_message   JSONB NOT NULL,
    created_at  TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_pt_messages_trade_id ON qfixpt_messages(trade_id);
CREATE INDEX IF NOT EXISTS idx_pt_messages_created_at ON qfixpt_messages(created_at);

CREATE TABLE IF NOT EXISTS qfixpt_logs (
    id          UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    trade_id    TEXT NOT NULL UNIQUE,
    raw_msg     TEXT NOT NULL,
    created_at  TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    updated_at  TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
