diff --git a/server/db/database.js b/server/db/database.js index 1abd792..902da80 100644 --- a/server/db/database.js +++ b/server/db/database.js @@ -142,6 +142,17 @@ const migrations = [ // playlist_items conversion (migrateAssignmentsToPlaylists) dropped this // column. Column ADD is idempotent via the surrounding try/catch loop. "ALTER TABLE playlist_items ADD COLUMN zone_id TEXT REFERENCES layout_zones(id) ON DELETE SET NULL", + // Slice 1: idempotency guard for the one-time signup welcome/admin emails. + // Non-null = this user has already been handled, so we never double-send. + // New signups are stamped with the real unix-seconds time the send block ran + // (see services/signupEmails.js). The paired backfill below stamps every + // pre-existing user with the sentinel value 1, so that a future "IS NULL" + // sweep/nudge can't mistake the legacy user base for un-welcomed accounts and + // blast all of them. Sentinel 1 (vs a real timestamp) also lets a later + // deliberate campaign tell "backfilled, never emailed" apart from "genuinely + // sent at