mirror of
https://github.com/warmbly/warmbly.git
synced 2026-11-29 08:06:27 +00:00
12 lines
566 B
SQL
12 lines
566 B
SQL
-- Live segment -> campaign links. Contacts matching an attached segment are
|
|
-- enrolled as campaign leads automatically; enrolment is additive, so a
|
|
-- contact falling out of the segment keeps their lead row.
|
|
CREATE TABLE campaign_segments (
|
|
campaign_id uuid NOT NULL REFERENCES campaigns (id) ON DELETE CASCADE,
|
|
segment_id uuid NOT NULL REFERENCES segments (id) ON DELETE CASCADE,
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (campaign_id, segment_id)
|
|
);
|
|
|
|
CREATE INDEX idx_campaign_segments_segment ON campaign_segments (segment_id);
|