diff --git a/prisma/migrations/20251007104950_adjust_text_type/migration.sql b/prisma/migrations/20251007104950_adjust_text_type/migration.sql new file mode 100644 index 0000000..af5102c --- /dev/null +++ b/prisma/migrations/20251007104950_adjust_text_type/migration.sql @@ -0,0 +1 @@ +-- This is an empty migration. \ No newline at end of file diff --git a/prisma/migrations/20251007121656_noneedrefresh_token/migration.sql b/prisma/migrations/20251007121656_noneedrefresh_token/migration.sql new file mode 100644 index 0000000..2015a0c --- /dev/null +++ b/prisma/migrations/20251007121656_noneedrefresh_token/migration.sql @@ -0,0 +1,9 @@ +/* + Warnings: + + - You are about to drop the column `refreshToken` on the `Account` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE `Account` DROP COLUMN `refreshToken`, + MODIFY `accessToken` TEXT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 267ebd3..9fe0835 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -29,8 +29,7 @@ model Account { name String? // 用户名称 avatarUrl String? // 用户头像URL providerData Json? // OAuth提供者返回的完整信息 - accessToken String @db.Text // 账户访问令牌 - refreshToken String? @db.Text // OAuth refresh token (如果提供者支持) - 可能很长,使用 TEXT + accessToken String? @db.Text // 账户访问令牌 createdAt DateTime @default(now()) updatedAt DateTime @updatedAt diff --git a/routes/accounts.js b/routes/accounts.js index 71df6b3..b04d5f1 100644 --- a/routes/accounts.js +++ b/routes/accounts.js @@ -310,7 +310,7 @@ router.get("/oauth/:provider/callback", async (req, res) => { name: normalizedUser.name || account.name, avatarUrl: normalizedUser.avatarUrl || account.avatarUrl, providerData: userData, - refreshToken: tokenData.refresh_token || account.refreshToken, + //refreshToken: tokenData.refresh_token || account.refreshToken, updatedAt: new Date(), }, }); @@ -326,7 +326,7 @@ router.get("/oauth/:provider/callback", async (req, res) => { avatarUrl: normalizedUser.avatarUrl, providerData: userData, accessToken, - refreshToken: tokenData.refresh_token, + //refreshToken: tokenData.refresh_token, }, }); }