lang-database 12.0.0 → 12.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the `_PackToUser` table. If the table is not empty, all the data it contains will be lost.
5
+
6
+ */
7
+ -- DropForeignKey
8
+ ALTER TABLE "_PackToUser" DROP CONSTRAINT "_PackToUser_A_fkey";
9
+
10
+ -- DropForeignKey
11
+ ALTER TABLE "_PackToUser" DROP CONSTRAINT "_PackToUser_B_fkey";
12
+
13
+ -- DropTable
14
+ DROP TABLE "_PackToUser";
15
+
16
+ -- CreateTable
17
+ CREATE TABLE "userDecks" (
18
+ "userId" TEXT NOT NULL,
19
+ "deckId" TEXT NOT NULL,
20
+ "reverse" BOOLEAN NOT NULL,
21
+ "allCards" INTEGER NOT NULL,
22
+ "newCards" INTEGER NOT NULL,
23
+ "inProgressCards" INTEGER NOT NULL,
24
+ "doneCards" INTEGER NOT NULL,
25
+
26
+ CONSTRAINT "userDecks_pkey" PRIMARY KEY ("userId","deckId","reverse")
27
+ );
28
+
29
+ -- AddForeignKey
30
+ ALTER TABLE "userDecks" ADD CONSTRAINT "userDecks_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
31
+
32
+ -- AddForeignKey
33
+ ALTER TABLE "userDecks" ADD CONSTRAINT "userDecks_deckId_fkey" FOREIGN KEY ("deckId") REFERENCES "packs"("id") ON DELETE CASCADE ON UPDATE CASCADE;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lang-database",
3
- "version": "12.0.0",
3
+ "version": "12.1.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/schema.prisma CHANGED
@@ -31,15 +31,31 @@ model UserCard {
31
31
  card Card @relation(fields: [cardId], references: [id], onDelete: Cascade)
32
32
  cardId String
33
33
  reverse Boolean
34
+
34
35
  done Boolean @default(false)
35
36
  currentInterval Int?
36
37
  dueDate DateTime?
37
38
 
38
-
39
39
  @@id([userId, cardId, reverse])
40
40
  @@map("userCards")
41
41
  }
42
42
 
43
+ model UserDeck {
44
+ user User @relation(fields: [userId], references: [id])
45
+ userId String
46
+ deck Pack @relation(fields: [deckId], references: [id], onDelete: Cascade)
47
+ deckId String
48
+ reverse Boolean
49
+
50
+ allCards Int
51
+ newCards Int
52
+ inProgressCards Int
53
+ doneCards Int
54
+
55
+ @@id([userId, deckId, reverse])
56
+ @@map("userDecks")
57
+ }
58
+
43
59
  model UserStat {
44
60
  user User @relation(fields: [userId], references: [id])
45
61
  userId String
@@ -74,8 +90,8 @@ model Pack {
74
90
  published Boolean @default(false)
75
91
  currentPrice Decimal
76
92
  public Boolean @default(false)
93
+ userDecks UserDeck[]
77
94
  cards Card[]
78
- users User[]
79
95
  purchases Purchase[]
80
96
  teams Team[]
81
97
  @@map("packs")
@@ -90,8 +106,8 @@ model User {
90
106
  googleUser GoogleUser?
91
107
  achievements Achievement[]
92
108
  purchases Purchase[]
93
- packs Pack[]
94
109
  userCards UserCard[]
110
+ userDecks UserDeck[]
95
111
  userStat UserStat?
96
112
  userAnswers UserAnswer[]
97
113
  subscriptionExpire DateTime?