drink-it-cold/sql/migrations/022_review_mail_log.sql

17 lines
833 B
MySQL
Raw Normal View History

-- Automatische Bewertungsmail eine Woche nach der Rückgabe.
--
-- Die Mail („Ihre Meinung ist uns wichtig“ mit Google-Bewertungslink) hat der
-- Kunde bisher manuell verschickt. Der tägliche Erinnerungslauf erzeugt sie
-- jetzt selbst; dieses Protokoll stellt sicher, dass jeder Kunde genau eine
-- Mail bekommt (auch wenn der Cron einen Tag ausfällt).
CREATE TABLE IF NOT EXISTS review_mail_log (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
booking_id BIGINT UNSIGNED NOT NULL,
sent_to VARCHAR(190) NOT NULL,
sent_at DATETIME NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY uq_review_mail_booking (booking_id),
KEY idx_review_mail_sent (sent_at),
CONSTRAINT fk_review_mail_booking FOREIGN KEY (booking_id) REFERENCES bookings (id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;