Files
fitme3070.pt/database/migration_20260612_users_consent_provenance.sql
2026-06-12 21:20:23 +01:00

9 lines
619 B
SQL

-- ─── Marketing-consent provenance on users (D2) ─────────────────────────────
-- `marketing_consent` is a bare boolean — the GDPR requires demonstrable consent
-- (when and how it was given). Add a timestamp and a source so consent can be
-- proven and audited. Nullable: existing rows have unknown provenance.
ALTER TABLE `users`
ADD COLUMN IF NOT EXISTS `marketing_consent_at` DATETIME DEFAULT NULL AFTER `marketing_consent`,
ADD COLUMN IF NOT EXISTS `marketing_consent_source` VARCHAR(60) DEFAULT NULL AFTER `marketing_consent_at`;