-- Ported from backend/src/main/resources/db/migration/V3__pass_delivery.sql

CREATE TABLE pass_deliveries (
    id               BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    created_at       TIMESTAMP    NOT NULL,
    updated_at       TIMESTAMP    NOT NULL,
    visit_request_id BIGINT       NOT NULL,
    channel          VARCHAR(20),
    recipient        VARCHAR(120),
    status           VARCHAR(20)  NOT NULL,
    attempts         INTEGER      NOT NULL,
    last_error       VARCHAR(500)
);
CREATE INDEX idx_pd_status ON pass_deliveries (status);
CREATE INDEX idx_pd_visit_request ON pass_deliveries (visit_request_id);
