my-kaiqiuwang/prisma/migrations/20260316024219_add_new_fav_table/migration.sql
kyuuseiryuu 9c9b3735cb feat: migrate user fav system from session aud to Logto sub
- Update database schema to rename `UserFav` to `LogtoUserFav` with clearer field names (`logto_uid`, `kaiqiu_uid`).
- Bump `jose` dependency to v6.2.1 for improved JWT verification.
- Configure `@logto/react` to request the correct resource token for API access.
- Implement token verification on the server side using `jose` and `jwtVerify`.
- Update API routes (`/api/fav`) to extract the user ID from the verified JWT `sub` claim instead of the URL `aud` parameter.
- Refactor frontend components (`FavButton`, `FavePlayersPage`) to use `useAuthHeaders` for fetching auth headers instead of manual token claims extraction.
- Clean up unused migration and DAO functions related to the old `aud`-based logic.
2026-03-16 12:45:12 +09:00

8 lines
229 B
SQL

-- CreateTable
CREATE TABLE `LogtoUserFav` (
`logto_uid` VARCHAR(191) NOT NULL,
`kaiqiu_uid` VARCHAR(191) NOT NULL,
PRIMARY KEY (`logto_uid`, `kaiqiu_uid`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;