Why this matters
Limits exposure and fulfills storage limitation obligations.
PII tables must include an expires_at (or retention_policy) column and a scheduled deletion/archival job aligned to data category. No indefinite retention. (GDPR Art. 5(1)(e))
Limits exposure and fulfills storage limitation obligations.
Side-by-side examples engineers can pattern-match during review.
CREATE TABLE events (
id BIGSERIAL PRIMARY KEY,
email TEXT,
created_at TIMESTAMPTZ NOT NULL
); -- no retentionCREATE TABLE events (
id BIGSERIAL PRIMARY KEY,
email_hash TEXT,
created_at TIMESTAMPTZ NOT NULL,
expires_at TIMESTAMPTZ NOT NULL -- e.g., NOW() + INTERVAL '13 months'
);
-- Deletion job (pseudo)
-- RUN DAILY: DELETE FROM events WHERE expires_at <= NOW();DELETE FROM events WHERE expires_at <= NOW();SELECT COUNT() FROM events WHERE created_at < NOW() - INTERVAL '5 years'; -- but never deletingFrom the same buckets as this rule.