From d73b5615700110fdb094aae166f372c3efcb91d5 Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Wed, 26 Aug 2026 16:05:36 +0300 Subject: [PATCH] cmd/deliberi-migrate: copy the new inflight signup fields Signed-off-by: Anirudh Oppiliappan --- cmd/deliberi-migrate/main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/deliberi-migrate/main.go b/cmd/deliberi-migrate/main.go index 33b051e60..cdf932dcc 100644 --- a/cmd/deliberi-migrate/main.go +++ b/cmd/deliberi-migrate/main.go @@ -186,7 +186,9 @@ func copySignupsInflight(src *sql.DB, tx *sql.Tx) error { } defer rows.Close() - stmt, err := tx.Prepare(`insert into signups_inflight (email, invite_code, created) values (?, ?, ?)`) + // legacy rows have no token; mint one per row so the unique index holds + stmt, err := tx.Prepare(`insert into signups_inflight (email, invite_code, verification_token, created, expires_at, last_sent) + values (?, ?, lower(hex(randomblob(32))), ?, strftime('%Y-%m-%dT%H:%M:%SZ', 'now', '+24 hours'), strftime('%Y-%m-%dT%H:%M:%SZ', 'now', '-1 day'))`) if err != nil { return fmt.Errorf("prepare: %w", err) } @@ -317,8 +319,12 @@ create table if not exists signups_inflight ( id integer primary key autoincrement, email text not null unique, invite_code text not null, - created text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')) + verification_token text not null default '', + created text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')), + expires_at text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now', '+24 hours')), + last_sent text not null default (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')) ); +create unique index if not exists signups_inflight_verification_token_unique on signups_inflight (verification_token); create table if not exists notifications ( id integer primary key autoincrement, -- 2.51.2