Skip to content

Commit a4631fc

Browse files
committed
feat: add custom instances database
1 parent 6f26bcd commit a4631fc

File tree

4 files changed

+60
-10
lines changed

4 files changed

+60
-10
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-- CreateTable
2+
CREATE TABLE "Instance" (
3+
"id" TEXT NOT NULL,
4+
"userId" TEXT NOT NULL,
5+
"botId" TEXT NOT NULL,
6+
"memoryLimit" TEXT NOT NULL DEFAULT '128',
7+
"type" TEXT NOT NULL,
8+
"node" TEXT NOT NULL,
9+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
10+
"updatedAt" TIMESTAMP(3) NOT NULL,
11+
12+
CONSTRAINT "Instance_pkey" PRIMARY KEY ("id")
13+
);
14+
15+
-- AddForeignKey
16+
ALTER TABLE "Instance" ADD CONSTRAINT "Instance_id_fkey" FOREIGN KEY ("id") REFERENCES "User"("userId") ON DELETE CASCADE ON UPDATE NO ACTION;

packages/prisma/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"@typescript-eslint/eslint-plugin": "^6.5.0",
3333
"@typescript-eslint/parser": "^6.5.0",
3434
"eslint": "^8.48.0",
35+
"prisma": "^5.2.0",
3536
"rimraf": "^5.0.1",
3637
"typescript": "^5.2.2"
3738
},
@@ -53,6 +54,6 @@
5354
"schema.prisma"
5455
],
5556
"dependencies": {
56-
"@prisma/client": "^5.2.0"
57+
"@prisma/client": "^5.1.1"
5758
}
5859
}

packages/prisma/schema.prisma

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,21 @@ model Phising {
222222
@@id([guildId, clientId])
223223
}
224224

225+
model Instance {
226+
id String @id @default(cuid())
227+
userId String
228+
botId String
229+
230+
memoryLimit String @default("128")
231+
type String
232+
node String
233+
234+
createdAt DateTime @default(now())
235+
updatedAt DateTime @updatedAt
236+
237+
user User @relation(fields: [id], references: [userId], onDelete: Cascade, onUpdate: NoAction)
238+
}
239+
225240
model User {
226241
id String @default(cuid())
227242
userId String @id
@@ -230,8 +245,10 @@ model User {
230245
tier TierType @default(FREE)
231246
type PremiumType @default(OTHER)
232247
233-
tier1Tickets Int @default(0)
234-
tier2Tickets Int @default(0)
248+
tier1Tickets Int @default(0)
249+
tier2Tickets Int @default(0)
250+
251+
instances Instance[]
235252
236253
createdAt DateTime @default(now())
237254
updatedAt DateTime @updatedAt

pnpm-lock.yaml

Lines changed: 23 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)