From 2d5b15c067f61d9999794cb053990317ca4fb242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 14 Jun 2026 21:23:56 +0200 Subject: [PATCH] Drop unused polar refresh-token column --- .../0160_v1170_new_measurement_sources/migration.sql | 2 -- prisma/schema.prisma | 1 - src/app/api/polar/callback/route.ts | 3 +-- src/app/api/polar/disconnect/route.ts | 1 - 4 files changed, 1 insertion(+), 6 deletions(-) diff --git a/prisma/migrations/0160_v1170_new_measurement_sources/migration.sql b/prisma/migrations/0160_v1170_new_measurement_sources/migration.sql index 8931b5dfb..ce2d6c27c 100644 --- a/prisma/migrations/0160_v1170_new_measurement_sources/migration.sql +++ b/prisma/migrations/0160_v1170_new_measurement_sources/migration.sql @@ -40,8 +40,6 @@ ALTER TABLE "users" -- ── 3. users — Polar OAuth credentials (encrypted at app level) ──────── ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "polar_access_token_encrypted" TEXT; -ALTER TABLE "users" - ADD COLUMN IF NOT EXISTS "polar_refresh_token_encrypted" TEXT; ALTER TABLE "users" ADD COLUMN IF NOT EXISTS "polar_user_id_encrypted" TEXT; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 38c126279..ba56aa388 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -126,7 +126,6 @@ model User { // product, so each self-hoster registers their own Polar app and the OAuth // tokens are stored encrypted. polarAccessTokenEncrypted String? @map("polar_access_token_encrypted") - polarRefreshTokenEncrypted String? @map("polar_refresh_token_encrypted") polarUserIdEncrypted String? @map("polar_user_id_encrypted") // v1.17.0 — Oura OAuth credentials (F4, per-user, encrypted at app level). diff --git a/src/app/api/polar/callback/route.ts b/src/app/api/polar/callback/route.ts index 10cfd08fc..34b084e45 100644 --- a/src/app/api/polar/callback/route.ts +++ b/src/app/api/polar/callback/route.ts @@ -94,8 +94,7 @@ export const GET = apiHandler(async (request: NextRequest) => { where: { id: userId }, data: { polarAccessTokenEncrypted: encrypt(tokens.access_token), - // Polar issues no refresh token; the column stays null. - polarRefreshTokenEncrypted: null, + // Polar issues no refresh token, so no refresh column is stored. polarUserIdEncrypted: encrypt(polarUserId), }, }); diff --git a/src/app/api/polar/disconnect/route.ts b/src/app/api/polar/disconnect/route.ts index f39a73692..07727ffa1 100644 --- a/src/app/api/polar/disconnect/route.ts +++ b/src/app/api/polar/disconnect/route.ts @@ -36,7 +36,6 @@ export const POST = apiHandler(async () => { where: { id: user.id }, data: { polarAccessTokenEncrypted: null, - polarRefreshTokenEncrypted: null, polarUserIdEncrypted: null, }, });