-- +goose Up CREATE TABLE if not exists outbox ( id bigserial PRIMARY KEY, order_id BIGINT NOT NULL, topic text NOT NULL, key text, payload jsonb NOT NULL, status text NOT NULL DEFAULT 'new', -- new | sent | error created_at timestamptz NOT NULL DEFAULT now(), sent_at timestamptz ); CREATE INDEX ON outbox (status, created_at); -- +goose Down DROP TABLE outbox;