File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
migrations/20230227084111_use_computed_id_for_user_repo_data Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ Warnings:
3+
4+ - The primary key for the `UserRepoData` table will be changed. If it partially fails, the table could be left without primary key constraint.
5+ - You are about to drop the column `id` on the `UserRepoData` table. All the data in the column will be lost.
6+
7+ */
8+ -- AlterTable
9+ ALTER TABLE " UserRepoData" DROP CONSTRAINT " UserRepoData_pkey" ,
10+ DROP COLUMN " id" ,
11+ ADD CONSTRAINT " UserRepoData_pkey" PRIMARY KEY (" userId" , " repoId" );
Original file line number Diff line number Diff line change @@ -53,13 +53,15 @@ model User {
5353}
5454
5555model UserRepoData {
56- id String @id
5756 user User @relation (fields : [userId ] , references : [id ] )
5857 userId String
5958 repo Repo @relation (fields : [repoId ] , references : [id ] )
6059 repoId String
6160 accessedAt DateTime @default (now () ) @updatedAt
6261 dummyCount Int @default (0 )
62+
63+ // use computed ID
64+ @@id ([userId , repoId ] )
6365}
6466
6567model Repo {
You can’t perform that action at this time.
0 commit comments