Skip to content

Commit b19ec58

Browse files
committed
account and session table related migration added
Signed-off-by: shitrerohit <[email protected]>
1 parent 97d8f79 commit b19ec58

File tree

2 files changed

+59
-7
lines changed

2 files changed

+59
-7
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `access_token` on the `account` table. All the data in the column will be lost.
5+
- You are about to drop the column `expires_at` on the `account` table. All the data in the column will be lost.
6+
- You are about to drop the column `id_token` on the `account` table. All the data in the column will be lost.
7+
- You are about to drop the column `refresh_token` on the `account` table. All the data in the column will be lost.
8+
- You are about to drop the column `session_state` on the `account` table. All the data in the column will be lost.
9+
- You are about to drop the column `token_type` on the `account` table. All the data in the column will be lost.
10+
- You are about to drop the column `refresh_token` on the `session` table. All the data in the column will be lost.
11+
- A unique constraint covering the columns `[refreshToken]` on the table `account` will be added. If there are existing duplicate values, this will fail.
12+
- A unique constraint covering the columns `[accessToken]` on the table `account` will be added. If there are existing duplicate values, this will fail.
13+
- A unique constraint covering the columns `[refreshToken]` on the table `session` will be added. If there are existing duplicate values, this will fail.
14+
15+
*/
16+
-- DropIndex
17+
DROP INDEX "account_access_token_key";
18+
19+
-- DropIndex
20+
DROP INDEX "account_refresh_token_key";
21+
22+
-- DropIndex
23+
DROP INDEX "session_refresh_token_key";
24+
25+
-- AlterTable
26+
ALTER TABLE "account" DROP COLUMN "access_token",
27+
DROP COLUMN "expires_at",
28+
DROP COLUMN "id_token",
29+
DROP COLUMN "refresh_token",
30+
DROP COLUMN "session_state",
31+
DROP COLUMN "token_type",
32+
ADD COLUMN "accessToken" TEXT,
33+
ADD COLUMN "expiresAt" INTEGER,
34+
ADD COLUMN "idToken" TEXT,
35+
ADD COLUMN "refreshToken" TEXT,
36+
ADD COLUMN "sessionState" TEXT,
37+
ADD COLUMN "tokenType" TEXT;
38+
39+
-- AlterTable
40+
ALTER TABLE "session" DROP COLUMN "refresh_token",
41+
ADD COLUMN "refreshToken" TEXT,
42+
ADD COLUMN "sessionType" TEXT;
43+
44+
-- CreateIndex
45+
CREATE UNIQUE INDEX "account_refreshToken_key" ON "account"("refreshToken");
46+
47+
-- CreateIndex
48+
CREATE UNIQUE INDEX "account_accessToken_key" ON "account"("accessToken");
49+
50+
-- CreateIndex
51+
CREATE UNIQUE INDEX "session_refreshToken_key" ON "session"("refreshToken");

libs/prisma-service/prisma/schema.prisma

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ model account {
4444
type String?
4545
provider String
4646
providerAccountId String
47-
refresh_token String? @unique
48-
access_token String? @unique
49-
expires_at Int?
50-
token_type String?
47+
refreshToken String? @unique
48+
accessToken String? @unique
49+
expiresAt Int?
50+
tokenType String?
5151
scope String?
52-
id_token String?
53-
session_state String?
52+
idToken String?
53+
sessionState String?
5454
createdAt DateTime @default(now())
5555
updatedAt DateTime @updatedAt
5656
user user @relation(fields: [userId], references: [id])
@@ -62,11 +62,12 @@ model session {
6262
sessionToken String @unique
6363
userId String @db.Uuid
6464
expires Int
65-
refresh_token String? @unique
65+
refreshToken String? @unique
6666
user user @relation(fields: [userId], references: [id])
6767
createdAt DateTime @default(now())
6868
updatedAt DateTime @updatedAt
6969
accountId String? @db.Uuid
70+
sessionType String?
7071
account account? @relation(fields: [accountId], references:[id])
7172
}
7273

0 commit comments

Comments
 (0)