Newer
Older
CREATE TYPE xbus_emission_status AS ENUM (
'pending',
'sent',
'running',
'done',
'error'
);
CREATE TABLE xbus_emission_queue (
id SERIAL PRIMARY KEY,
created TIMESTAMP WITHOUT TIME ZONE DEFAULT NOW(),
msgtype TEXT NOT NULL,
content bytea NULL,
chunks bytea[] NULL,
related_to character varying NOT NULL DEFAULT '{}',
envelope_id uuid NULL,
process_id uuid NULL,
status xbus_emission_status DEFAULT 'pending'::xbus_emission_status NOT NULL,
log text DEFAULT ''::text NOT NULL,
date_sent TIMESTAMP WITHOUT TIME ZONE NULL,
date_running TIMESTAMP WITHOUT TIME ZONE NULL,
date_done TIMESTAMP WITHOUT TIME ZONE NULL,
date_error TIMESTAMP WITHOUT TIME ZONE NULL
);
CREATE UNIQUE INDEX xbus_emission_queue_envelope_id_idx
ON xbus_emission_queue (envelope_id);
CREATE INDEX xbus_emission_queue_status_idx
ON xbus_emission_queue (status);