--
-- Set of messages to be sent to parties. It is assumed that sending a
-- message either queues it in a real MTA or fails, so no information about
-- what's been tried how many times is kept.
--
CREATE TABLE acs_messages_outgoing (
message_id integer NOT NULL,
--
-- The email address to send this message to. Note that this will
-- probably become a party_id again once upgrading a party to a user
-- is possible.
--
to_address varchar(1000) NOT NULL,
--
-- This identifier is used to group sets of messages to be sent as
-- digests. When a message is about to be sent, any other messages
-- with the same grouping_id will be put together with it in a
-- digest. It is recommended but not required that an object id is
-- used. Bboard, for example, might use the forum id that the user's
-- subscribed to. For instant (non-digest) updates, it would be
-- appropriate to use null, which is never equal to anything else.
--
grouping_id integer,
--
-- Don't schedule a send until after this date. If another message with
-- the same grouping ID is scheduled to be sent, then this message may be
-- sent at the same time. (So, for example, daily digests would be
-- achieved by setting the grouping_id to the same value, and the wait_until
-- value to the end of the current day. As soon as one message in the group
-- is to be sent, all will be sent.)
--
wait_until timestamptz NOT NULL,
PRIMARY KEY (message_id,to_address),
ON DELETE CASCADE ON DELETE CASCADE,
CONSTRAINT acs_messages_outgoing_pk REFERENCES acs_messages (),
CONSTRAINT amo_message_id_fk REFERENCES acs_messages ()
);
CREATE TRIGGER RI_ConstraintTrigger_c_340654 AFTER INSERT FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_ins (disabled)
CREATE TRIGGER RI_ConstraintTrigger_c_340655 AFTER UPDATE FOR EACH ROW EXECUTE PROCEDURE RI_FKey_check_upd (disabled)
-- Table size: 0 bytes
-- Table rows: 0
Tables: