lang-database 17.0.0 → 17.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,15 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "BadgeReason" AS ENUM ('WeeklyGoal', 'MonthlyGoal', 'ManyCardsDone');
3
+
4
+ -- CreateTable
5
+ CREATE TABLE "badges" (
6
+ "id" TEXT NOT NULL,
7
+ "userId" TEXT NOT NULL,
8
+ "type" "BadgeReason" NOT NULL,
9
+ "timestamp" TIMESTAMP(3) NOT NULL,
10
+
11
+ CONSTRAINT "badges_pkey" PRIMARY KEY ("id")
12
+ );
13
+
14
+ -- AddForeignKey
15
+ ALTER TABLE "badges" ADD CONSTRAINT "badges_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -0,0 +1,10 @@
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `type` on the `badges` table. All the data in the column will be lost.
5
+ - Added the required column `reason` to the `badges` table without a default value. This is not possible if the table is not empty.
6
+
7
+ */
8
+ -- AlterTable
9
+ ALTER TABLE "badges" DROP COLUMN "type",
10
+ ADD COLUMN "reason" "BadgeReason" NOT NULL;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lang-database",
3
- "version": "17.0.0",
3
+ "version": "17.1.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/schema.prisma CHANGED
@@ -112,6 +112,7 @@ model User {
112
112
  password String?
113
113
  googleUser GoogleUser?
114
114
  achievements Achievement[]
115
+ badges Badge[]
115
116
  subscriptions Subscription[]
116
117
  userCards UserCard[]
117
118
  userDecks UserDeck[]
@@ -135,6 +136,22 @@ model Achievement {
135
136
  @@map("achievements")
136
137
  }
137
138
 
139
+ model Badge {
140
+ id String @id @default(cuid())
141
+ user User @relation(fields: [userId], references: [id])
142
+ userId String
143
+ reason BadgeReason
144
+ timestamp DateTime
145
+ @@map("badges")
146
+ }
147
+
148
+ enum BadgeReason {
149
+ WeeklyGoal
150
+ MonthlyGoal
151
+ ManyCardsDone
152
+ @@map("BadgeReason")
153
+ }
154
+
138
155
  enum AchievementType {
139
156
  Today15Min
140
157
  Weekly15Min