lang-database 12.1.0 → 13.0.0

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;
@@ -0,0 +1,41 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `amount` on the `purchases` table. All the data in the column will be lost.
5
+ - You are about to drop the column `currency` on the `purchases` table. All the data in the column will be lost.
6
+ - You are about to drop the column `orderDate` on the `purchases` table. All the data in the column will be lost.
7
+ - You are about to drop the column `packId` on the `purchases` table. All the data in the column will be lost.
8
+ - You are about to drop the column `paymentDate` on the `purchases` table. All the data in the column will be lost.
9
+ - You are about to drop the column `status` on the `purchases` table. All the data in the column will be lost.
10
+ - Added the required column `acknowledged` to the `purchases` table without a default value. This is not possible if the table is not empty.
11
+ - Added the required column `createdAt` to the `purchases` table without a default value. This is not possible if the table is not empty.
12
+ - Added the required column `expirationDate` to the `purchases` table without a default value. This is not possible if the table is not empty.
13
+ - Added the required column `purchaseToken` to the `purchases` table without a default value. This is not possible if the table is not empty.
14
+ - Added the required column `sku` to the `purchases` table without a default value. This is not possible if the table is not empty.
15
+ - Added the required column `state` to the `purchases` table without a default value. This is not possible if the table is not empty.
16
+ - Added the required column `updatedAt` to the `purchases` table without a default value. This is not possible if the table is not empty.
17
+
18
+ */
19
+ -- CreateEnum
20
+ CREATE TYPE "PurchaseState" AS ENUM ('PENDING', 'COMPLETED', 'REFUNDED', 'FAILED');
21
+
22
+ -- DropForeignKey
23
+ ALTER TABLE "purchases" DROP CONSTRAINT "purchases_packId_fkey";
24
+
25
+ -- AlterTable
26
+ ALTER TABLE "purchases" DROP COLUMN "amount",
27
+ DROP COLUMN "currency",
28
+ DROP COLUMN "orderDate",
29
+ DROP COLUMN "packId",
30
+ DROP COLUMN "paymentDate",
31
+ DROP COLUMN "status",
32
+ ADD COLUMN "acknowledged" BOOLEAN NOT NULL,
33
+ ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL,
34
+ ADD COLUMN "expirationDate" TIMESTAMP(3) NOT NULL,
35
+ ADD COLUMN "purchaseToken" TEXT NOT NULL,
36
+ ADD COLUMN "sku" TEXT NOT NULL,
37
+ ADD COLUMN "state" "PurchaseState" NOT NULL,
38
+ ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL;
39
+
40
+ -- DropEnum
41
+ DROP TYPE "PurchaseStatus";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lang-database",
3
- "version": "12.1.0",
3
+ "version": "13.0.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/schema.prisma CHANGED
@@ -33,7 +33,7 @@ model UserCard {
33
33
  reverse Boolean
34
34
 
35
35
  done Boolean @default(false)
36
- currentInterval Int? @db.SmallInt
36
+ currentInterval Int?
37
37
  dueDate DateTime?
38
38
 
39
39
  @@id([userId, cardId, reverse])
@@ -47,10 +47,10 @@ model UserDeck {
47
47
  deckId String
48
48
  reverse Boolean
49
49
 
50
- allCards Int @db.SmallInt
51
- newCards Int @db.SmallInt
52
- inProgressCards Int @db.SmallInt
53
- doneCards Int @db.SmallInt
50
+ allCards Int
51
+ newCards Int
52
+ inProgressCards Int
53
+ doneCards Int
54
54
 
55
55
  @@id([userId, deckId, reverse])
56
56
  @@map("userDecks")
@@ -73,7 +73,7 @@ model UserStat {
73
73
  model Category {
74
74
  id String @id @default(cuid())
75
75
  name String
76
- order Int? @db.SmallInt
76
+ order Int?
77
77
  packs Pack[]
78
78
  @@map("categories")
79
79
  }
@@ -92,7 +92,6 @@ model Pack {
92
92
  public Boolean @default(false)
93
93
  userDecks UserDeck[]
94
94
  cards Card[]
95
- purchases Purchase[]
96
95
  teams Team[]
97
96
  @@map("packs")
98
97
  }
@@ -186,22 +185,24 @@ enum Answer {
186
185
  UNKNOWN
187
186
  }
188
187
 
189
- enum PurchaseStatus {
188
+ enum PurchaseState {
190
189
  PENDING
191
- APPROVED
190
+ COMPLETED
191
+ REFUNDED
192
+ FAILED
192
193
  }
193
194
 
194
195
  model Purchase {
195
196
  id String @id @default(cuid())
196
197
  user User @relation(fields: [userId], references: [id])
197
198
  userId String
198
- pack Pack @relation(fields: [packId], references: [id])
199
- packId String
200
- currency String
201
- amount Decimal
202
- orderDate DateTime
203
- paymentDate DateTime?
204
- status PurchaseStatus
199
+ purchaseToken String
200
+ sku String
201
+ state PurchaseState
202
+ acknowledged Boolean
203
+ expirationDate DateTime
204
+ createdAt DateTime
205
+ updatedAt DateTime
205
206
 
206
207
  @@map("purchases")
207
208
  }