diff --git a/scripts/migrations/2026-05-24-rename-admin-email.js b/scripts/migrations/2026-05-24-rename-admin-email.js index ac880b0..7be1dfe 100644 --- a/scripts/migrations/2026-05-24-rename-admin-email.js +++ b/scripts/migrations/2026-05-24-rename-admin-email.js @@ -34,7 +34,11 @@ async function main() { const sql = neon(process.env.POSTGRES_URL); - const { rows: before } = await sql` + // NOTE: @neondatabase/serverless's tagged-template returns the rows array + // directly — NOT wrapped in { rows, rowCount } like @vercel/postgres does. + // See lib/database.js line 33 for the same finding. Do NOT destructure + // `{ rows: x }` from a `neon()` result; assign the result directly. + const before = await sql` SELECT id, email, role FROM users WHERE email LIKE '%@tcgvault.com' @@ -58,7 +62,7 @@ async function main() { WHERE email LIKE '%@tcgvault.com' `; - const { rows: after } = await sql` + const after = await sql` SELECT id, email, role FROM users WHERE email LIKE '%@deckhearth.com' @@ -70,7 +74,7 @@ async function main() { console.log(` id=${r.id} role=${r.role} email=${r.email}`); } - const { rows: stragglers } = await sql` + const stragglers = await sql` SELECT COUNT(*)::int AS count FROM users WHERE email LIKE '%@tcgvault.com' `; if (stragglers[0].count !== 0) {