Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

✨ Require an edit token on every response (#3186)

Luke Vellaadc103ee85a5
diff --git a/packages/database/prisma/migrations/20260905170000_require_participant_token/migration.sql b/packages/database/prisma/migrations/20260905170000_require_participant_token/migration.sql
new file mode 100644
index 000000000..278d5804a
--- /dev/null
+++ b/packages/database/prisma/migrations/20260905170000_require_participant_token/migration.sql
@@ -0,0 +1,8 @@
+-- Rows inserted by the previous release between the backfill and its
+-- promotion still carry no token. Same fill as the backfill.
+UPDATE "participants"
+SET "token" = replace(gen_random_uuid()::text, '-', '')
+WHERE "token" IS NULL;
+
+-- AlterTable
+ALTER TABLE "participants" ALTER COLUMN "token" SET NOT NULL;
diff --git a/packages/database/prisma/models/poll.prisma b/packages/database/prisma/models/poll.prisma
index 8218aeeb7..6c9d47794 100644
--- a/packages/database/prisma/models/poll.prisma
+++ b/packages/database/prisma/models/poll.prisma
@@ -73,8 +73,8 @@ model Participant {
name String
email String?
note String?
- /// Per response edit link: grants edit access to this response without a session. App minted at creation, CSPRNG alphanumeric ≥32 chars (nanoid customAlphabet — url safe with no linkifier edge cases, unlike base64url); never a DB default. A response created through an emailed invite takes the invite's token. Rows that predate minting were backfilled with gen_random_uuid() hex. Nullable only until the minting code is live everywhere: until then a code path that forgets to mint inserts NULL; once the follow-up migration makes the column required, it fails loudly instead
- token String? @unique
+ /// Per response edit link: grants edit access to this response without a session. App minted at creation, CSPRNG alphanumeric ≥32 chars (nanoid customAlphabet — url safe with no linkifier edge cases, unlike base64url); never a DB default so a code path that forgets to mint fails loudly. A response created through an emailed invite takes the invite's token. Rows that predate minting were backfilled with gen_random_uuid() hex
+ token String @unique
userId String? @map("user_id")
pollId String @map("poll_id")
locale String?