lang-database 17.1.1 → 18.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.
@@ -1,239 +1,239 @@
1
- -- CreateEnum
2
- CREATE TYPE "AchievementType" AS ENUM ('Today15Min', 'Weekly15Min', 'Monthly15Min', 'CardDone', 'FiveCardsDone', 'DeckDone', 'DeckAlreadyKnown');
3
-
4
- -- CreateEnum
5
- CREATE TYPE "Answer" AS ENUM ('KNOWN', 'ALMOST_KNOWN', 'HARD', 'UNKNOWN');
6
-
7
- -- CreateEnum
8
- CREATE TYPE "PurchaseStatus" AS ENUM ('PENDING', 'APPROVED');
9
-
10
- -- CreateTable
11
- CREATE TABLE "cards" (
12
- "id" TEXT NOT NULL,
13
- "packId" TEXT NOT NULL,
14
- "front" TEXT NOT NULL,
15
- "back" TEXT NOT NULL,
16
- "info" TEXT NOT NULL DEFAULT '',
17
- "lastUpdate" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
18
- "speechGenerated" BOOLEAN NOT NULL DEFAULT false,
19
-
20
- CONSTRAINT "cards_pkey" PRIMARY KEY ("id")
21
- );
22
-
23
- -- CreateTable
24
- CREATE TABLE "userCards" (
25
- "userId" TEXT NOT NULL,
26
- "cardId" TEXT NOT NULL,
27
- "reverse" BOOLEAN NOT NULL,
28
- "done" BOOLEAN NOT NULL DEFAULT false,
29
- "currentInterval" INTEGER,
30
- "dueDate" TIMESTAMP(3),
31
-
32
- CONSTRAINT "userCards_pkey" PRIMARY KEY ("userId","cardId","reverse")
33
- );
34
-
35
- -- CreateTable
36
- CREATE TABLE "userStats" (
37
- "userId" TEXT NOT NULL,
38
- "lastAnswerTimestamp" TIMESTAMP(3) NOT NULL,
39
- "dailyUsageSec" INTEGER NOT NULL,
40
- "weeklyUsageSec" INTEGER NOT NULL,
41
- "monthlyUsageSec" INTEGER NOT NULL,
42
- "cardsDone" INTEGER NOT NULL,
43
-
44
- CONSTRAINT "userStats_pkey" PRIMARY KEY ("userId")
45
- );
46
-
47
- -- CreateTable
48
- CREATE TABLE "categories" (
49
- "id" TEXT NOT NULL,
50
- "name" TEXT NOT NULL,
51
- "order" INTEGER,
52
-
53
- CONSTRAINT "categories_pkey" PRIMARY KEY ("id")
54
- );
55
-
56
- -- CreateTable
57
- CREATE TABLE "packs" (
58
- "id" TEXT NOT NULL,
59
- "teacherId" TEXT NOT NULL,
60
- "name" TEXT NOT NULL DEFAULT '',
61
- "shortDescription" TEXT NOT NULL DEFAULT '',
62
- "longDescription" TEXT NOT NULL DEFAULT '',
63
- "categoryId" TEXT,
64
- "published" BOOLEAN NOT NULL DEFAULT false,
65
- "currentPrice" DECIMAL(65,30) NOT NULL,
66
- "public" BOOLEAN NOT NULL DEFAULT false,
67
-
68
- CONSTRAINT "packs_pkey" PRIMARY KEY ("id")
69
- );
70
-
71
- -- CreateTable
72
- CREATE TABLE "users" (
73
- "id" TEXT NOT NULL,
74
- "email" TEXT NOT NULL,
75
- "timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
76
- "name" TEXT NOT NULL,
77
- "password" TEXT,
78
- "subscriptionExpire" TIMESTAMP(3),
79
- "teamId" TEXT,
80
- "passwordActivated" BOOLEAN NOT NULL DEFAULT false,
81
-
82
- CONSTRAINT "users_pkey" PRIMARY KEY ("id")
83
- );
84
-
85
- -- CreateTable
86
- CREATE TABLE "achievements" (
87
- "id" TEXT NOT NULL,
88
- "userId" TEXT NOT NULL,
89
- "badge" BOOLEAN NOT NULL,
90
- "type" "AchievementType" NOT NULL,
91
- "info" TEXT NOT NULL,
92
- "timestamp" TIMESTAMP(3) NOT NULL,
93
- "dismissed" BOOLEAN NOT NULL DEFAULT false,
94
-
95
- CONSTRAINT "achievements_pkey" PRIMARY KEY ("id")
96
- );
97
-
98
- -- CreateTable
99
- CREATE TABLE "teams" (
100
- "id" TEXT NOT NULL,
101
- "name" TEXT NOT NULL,
102
- "emailPattern" TEXT NOT NULL DEFAULT '',
103
- "userCount" INTEGER NOT NULL,
104
- "subscriptionExpire" TIMESTAMP(3),
105
-
106
- CONSTRAINT "teams_pkey" PRIMARY KEY ("id")
107
- );
108
-
109
- -- CreateTable
110
- CREATE TABLE "teachers" (
111
- "id" TEXT NOT NULL,
112
- "email" TEXT NOT NULL,
113
- "name" TEXT NOT NULL,
114
- "password" TEXT NOT NULL,
115
-
116
- CONSTRAINT "teachers_pkey" PRIMARY KEY ("id")
117
- );
118
-
119
- -- CreateTable
120
- CREATE TABLE "googleUsers" (
121
- "id" TEXT NOT NULL,
122
- "userId" TEXT NOT NULL,
123
-
124
- CONSTRAINT "googleUsers_pkey" PRIMARY KEY ("id")
125
- );
126
-
127
- -- CreateTable
128
- CREATE TABLE "userAnswers" (
129
- "id" TEXT NOT NULL,
130
- "userId" TEXT NOT NULL,
131
- "cardId" TEXT NOT NULL,
132
- "reverse" BOOLEAN NOT NULL,
133
- "answer" "Answer" NOT NULL,
134
- "timestamp" TIMESTAMP(3) NOT NULL,
135
-
136
- CONSTRAINT "userAnswers_pkey" PRIMARY KEY ("id")
137
- );
138
-
139
- -- CreateTable
140
- CREATE TABLE "purchases" (
141
- "id" TEXT NOT NULL,
142
- "userId" TEXT NOT NULL,
143
- "packId" TEXT NOT NULL,
144
- "currency" TEXT NOT NULL,
145
- "amount" DECIMAL(65,30) NOT NULL,
146
- "orderDate" TIMESTAMP(3) NOT NULL,
147
- "paymentDate" TIMESTAMP(3),
148
- "status" "PurchaseStatus" NOT NULL,
149
-
150
- CONSTRAINT "purchases_pkey" PRIMARY KEY ("id")
151
- );
152
-
153
- -- CreateTable
154
- CREATE TABLE "_PackToUser" (
155
- "A" TEXT NOT NULL,
156
- "B" TEXT NOT NULL,
157
-
158
- CONSTRAINT "_PackToUser_AB_pkey" PRIMARY KEY ("A","B")
159
- );
160
-
161
- -- CreateTable
162
- CREATE TABLE "_PackToTeam" (
163
- "A" TEXT NOT NULL,
164
- "B" TEXT NOT NULL,
165
-
166
- CONSTRAINT "_PackToTeam_AB_pkey" PRIMARY KEY ("A","B")
167
- );
168
-
169
- -- CreateIndex
170
- CREATE UNIQUE INDEX "cards_packId_front_key" ON "cards"("packId", "front");
171
-
172
- -- CreateIndex
173
- CREATE UNIQUE INDEX "cards_packId_back_key" ON "cards"("packId", "back");
174
-
175
- -- CreateIndex
176
- CREATE UNIQUE INDEX "IX_Users_Email" ON "users"("email");
177
-
178
- -- CreateIndex
179
- CREATE UNIQUE INDEX "IX_teachers_Email" ON "teachers"("email");
180
-
181
- -- CreateIndex
182
- CREATE UNIQUE INDEX "googleUsers_userId_key" ON "googleUsers"("userId");
183
-
184
- -- CreateIndex
185
- CREATE INDEX "_PackToUser_B_index" ON "_PackToUser"("B");
186
-
187
- -- CreateIndex
188
- CREATE INDEX "_PackToTeam_B_index" ON "_PackToTeam"("B");
189
-
190
- -- AddForeignKey
191
- ALTER TABLE "cards" ADD CONSTRAINT "cards_packId_fkey" FOREIGN KEY ("packId") REFERENCES "packs"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
192
-
193
- -- AddForeignKey
194
- ALTER TABLE "userCards" ADD CONSTRAINT "userCards_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
195
-
196
- -- AddForeignKey
197
- ALTER TABLE "userCards" ADD CONSTRAINT "userCards_cardId_fkey" FOREIGN KEY ("cardId") REFERENCES "cards"("id") ON DELETE CASCADE ON UPDATE CASCADE;
198
-
199
- -- AddForeignKey
200
- ALTER TABLE "userStats" ADD CONSTRAINT "userStats_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
201
-
202
- -- AddForeignKey
203
- ALTER TABLE "packs" ADD CONSTRAINT "packs_teacherId_fkey" FOREIGN KEY ("teacherId") REFERENCES "teachers"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
204
-
205
- -- AddForeignKey
206
- ALTER TABLE "packs" ADD CONSTRAINT "packs_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "categories"("id") ON DELETE SET NULL ON UPDATE CASCADE;
207
-
208
- -- AddForeignKey
209
- ALTER TABLE "users" ADD CONSTRAINT "users_teamId_fkey" FOREIGN KEY ("teamId") REFERENCES "teams"("id") ON DELETE SET NULL ON UPDATE CASCADE;
210
-
211
- -- AddForeignKey
212
- ALTER TABLE "achievements" ADD CONSTRAINT "achievements_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
213
-
214
- -- AddForeignKey
215
- ALTER TABLE "googleUsers" ADD CONSTRAINT "googleUsers_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
216
-
217
- -- AddForeignKey
218
- ALTER TABLE "userAnswers" ADD CONSTRAINT "userAnswers_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
219
-
220
- -- AddForeignKey
221
- ALTER TABLE "userAnswers" ADD CONSTRAINT "userAnswers_cardId_fkey" FOREIGN KEY ("cardId") REFERENCES "cards"("id") ON DELETE CASCADE ON UPDATE CASCADE;
222
-
223
- -- AddForeignKey
224
- ALTER TABLE "purchases" ADD CONSTRAINT "purchases_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
225
-
226
- -- AddForeignKey
227
- ALTER TABLE "purchases" ADD CONSTRAINT "purchases_packId_fkey" FOREIGN KEY ("packId") REFERENCES "packs"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
228
-
229
- -- AddForeignKey
230
- ALTER TABLE "_PackToUser" ADD CONSTRAINT "_PackToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "packs"("id") ON DELETE CASCADE ON UPDATE CASCADE;
231
-
232
- -- AddForeignKey
233
- ALTER TABLE "_PackToUser" ADD CONSTRAINT "_PackToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
234
-
235
- -- AddForeignKey
236
- ALTER TABLE "_PackToTeam" ADD CONSTRAINT "_PackToTeam_A_fkey" FOREIGN KEY ("A") REFERENCES "packs"("id") ON DELETE CASCADE ON UPDATE CASCADE;
237
-
238
- -- AddForeignKey
239
- ALTER TABLE "_PackToTeam" ADD CONSTRAINT "_PackToTeam_B_fkey" FOREIGN KEY ("B") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
1
+ -- CreateEnum
2
+ CREATE TYPE "AchievementType" AS ENUM ('Today15Min', 'Weekly15Min', 'Monthly15Min', 'CardDone', 'FiveCardsDone', 'DeckDone', 'DeckAlreadyKnown');
3
+
4
+ -- CreateEnum
5
+ CREATE TYPE "Answer" AS ENUM ('KNOWN', 'ALMOST_KNOWN', 'HARD', 'UNKNOWN');
6
+
7
+ -- CreateEnum
8
+ CREATE TYPE "PurchaseStatus" AS ENUM ('PENDING', 'APPROVED');
9
+
10
+ -- CreateTable
11
+ CREATE TABLE "cards" (
12
+ "id" TEXT NOT NULL,
13
+ "packId" TEXT NOT NULL,
14
+ "front" TEXT NOT NULL,
15
+ "back" TEXT NOT NULL,
16
+ "info" TEXT NOT NULL DEFAULT '',
17
+ "lastUpdate" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
18
+ "speechGenerated" BOOLEAN NOT NULL DEFAULT false,
19
+
20
+ CONSTRAINT "cards_pkey" PRIMARY KEY ("id")
21
+ );
22
+
23
+ -- CreateTable
24
+ CREATE TABLE "userCards" (
25
+ "userId" TEXT NOT NULL,
26
+ "cardId" TEXT NOT NULL,
27
+ "reverse" BOOLEAN NOT NULL,
28
+ "done" BOOLEAN NOT NULL DEFAULT false,
29
+ "currentInterval" INTEGER,
30
+ "dueDate" TIMESTAMP(3),
31
+
32
+ CONSTRAINT "userCards_pkey" PRIMARY KEY ("userId","cardId","reverse")
33
+ );
34
+
35
+ -- CreateTable
36
+ CREATE TABLE "userStats" (
37
+ "userId" TEXT NOT NULL,
38
+ "lastAnswerTimestamp" TIMESTAMP(3) NOT NULL,
39
+ "dailyUsageSec" INTEGER NOT NULL,
40
+ "weeklyUsageSec" INTEGER NOT NULL,
41
+ "monthlyUsageSec" INTEGER NOT NULL,
42
+ "cardsDone" INTEGER NOT NULL,
43
+
44
+ CONSTRAINT "userStats_pkey" PRIMARY KEY ("userId")
45
+ );
46
+
47
+ -- CreateTable
48
+ CREATE TABLE "categories" (
49
+ "id" TEXT NOT NULL,
50
+ "name" TEXT NOT NULL,
51
+ "order" INTEGER,
52
+
53
+ CONSTRAINT "categories_pkey" PRIMARY KEY ("id")
54
+ );
55
+
56
+ -- CreateTable
57
+ CREATE TABLE "packs" (
58
+ "id" TEXT NOT NULL,
59
+ "teacherId" TEXT NOT NULL,
60
+ "name" TEXT NOT NULL DEFAULT '',
61
+ "shortDescription" TEXT NOT NULL DEFAULT '',
62
+ "longDescription" TEXT NOT NULL DEFAULT '',
63
+ "categoryId" TEXT,
64
+ "published" BOOLEAN NOT NULL DEFAULT false,
65
+ "currentPrice" DECIMAL(65,30) NOT NULL,
66
+ "public" BOOLEAN NOT NULL DEFAULT false,
67
+
68
+ CONSTRAINT "packs_pkey" PRIMARY KEY ("id")
69
+ );
70
+
71
+ -- CreateTable
72
+ CREATE TABLE "users" (
73
+ "id" TEXT NOT NULL,
74
+ "email" TEXT NOT NULL,
75
+ "timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
76
+ "name" TEXT NOT NULL,
77
+ "password" TEXT,
78
+ "subscriptionExpire" TIMESTAMP(3),
79
+ "teamId" TEXT,
80
+ "passwordActivated" BOOLEAN NOT NULL DEFAULT false,
81
+
82
+ CONSTRAINT "users_pkey" PRIMARY KEY ("id")
83
+ );
84
+
85
+ -- CreateTable
86
+ CREATE TABLE "achievements" (
87
+ "id" TEXT NOT NULL,
88
+ "userId" TEXT NOT NULL,
89
+ "badge" BOOLEAN NOT NULL,
90
+ "type" "AchievementType" NOT NULL,
91
+ "info" TEXT NOT NULL,
92
+ "timestamp" TIMESTAMP(3) NOT NULL,
93
+ "dismissed" BOOLEAN NOT NULL DEFAULT false,
94
+
95
+ CONSTRAINT "achievements_pkey" PRIMARY KEY ("id")
96
+ );
97
+
98
+ -- CreateTable
99
+ CREATE TABLE "teams" (
100
+ "id" TEXT NOT NULL,
101
+ "name" TEXT NOT NULL,
102
+ "emailPattern" TEXT NOT NULL DEFAULT '',
103
+ "userCount" INTEGER NOT NULL,
104
+ "subscriptionExpire" TIMESTAMP(3),
105
+
106
+ CONSTRAINT "teams_pkey" PRIMARY KEY ("id")
107
+ );
108
+
109
+ -- CreateTable
110
+ CREATE TABLE "teachers" (
111
+ "id" TEXT NOT NULL,
112
+ "email" TEXT NOT NULL,
113
+ "name" TEXT NOT NULL,
114
+ "password" TEXT NOT NULL,
115
+
116
+ CONSTRAINT "teachers_pkey" PRIMARY KEY ("id")
117
+ );
118
+
119
+ -- CreateTable
120
+ CREATE TABLE "googleUsers" (
121
+ "id" TEXT NOT NULL,
122
+ "userId" TEXT NOT NULL,
123
+
124
+ CONSTRAINT "googleUsers_pkey" PRIMARY KEY ("id")
125
+ );
126
+
127
+ -- CreateTable
128
+ CREATE TABLE "userAnswers" (
129
+ "id" TEXT NOT NULL,
130
+ "userId" TEXT NOT NULL,
131
+ "cardId" TEXT NOT NULL,
132
+ "reverse" BOOLEAN NOT NULL,
133
+ "answer" "Answer" NOT NULL,
134
+ "timestamp" TIMESTAMP(3) NOT NULL,
135
+
136
+ CONSTRAINT "userAnswers_pkey" PRIMARY KEY ("id")
137
+ );
138
+
139
+ -- CreateTable
140
+ CREATE TABLE "purchases" (
141
+ "id" TEXT NOT NULL,
142
+ "userId" TEXT NOT NULL,
143
+ "packId" TEXT NOT NULL,
144
+ "currency" TEXT NOT NULL,
145
+ "amount" DECIMAL(65,30) NOT NULL,
146
+ "orderDate" TIMESTAMP(3) NOT NULL,
147
+ "paymentDate" TIMESTAMP(3),
148
+ "status" "PurchaseStatus" NOT NULL,
149
+
150
+ CONSTRAINT "purchases_pkey" PRIMARY KEY ("id")
151
+ );
152
+
153
+ -- CreateTable
154
+ CREATE TABLE "_PackToUser" (
155
+ "A" TEXT NOT NULL,
156
+ "B" TEXT NOT NULL,
157
+
158
+ CONSTRAINT "_PackToUser_AB_pkey" PRIMARY KEY ("A","B")
159
+ );
160
+
161
+ -- CreateTable
162
+ CREATE TABLE "_PackToTeam" (
163
+ "A" TEXT NOT NULL,
164
+ "B" TEXT NOT NULL,
165
+
166
+ CONSTRAINT "_PackToTeam_AB_pkey" PRIMARY KEY ("A","B")
167
+ );
168
+
169
+ -- CreateIndex
170
+ CREATE UNIQUE INDEX "cards_packId_front_key" ON "cards"("packId", "front");
171
+
172
+ -- CreateIndex
173
+ CREATE UNIQUE INDEX "cards_packId_back_key" ON "cards"("packId", "back");
174
+
175
+ -- CreateIndex
176
+ CREATE UNIQUE INDEX "IX_Users_Email" ON "users"("email");
177
+
178
+ -- CreateIndex
179
+ CREATE UNIQUE INDEX "IX_teachers_Email" ON "teachers"("email");
180
+
181
+ -- CreateIndex
182
+ CREATE UNIQUE INDEX "googleUsers_userId_key" ON "googleUsers"("userId");
183
+
184
+ -- CreateIndex
185
+ CREATE INDEX "_PackToUser_B_index" ON "_PackToUser"("B");
186
+
187
+ -- CreateIndex
188
+ CREATE INDEX "_PackToTeam_B_index" ON "_PackToTeam"("B");
189
+
190
+ -- AddForeignKey
191
+ ALTER TABLE "cards" ADD CONSTRAINT "cards_packId_fkey" FOREIGN KEY ("packId") REFERENCES "packs"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
192
+
193
+ -- AddForeignKey
194
+ ALTER TABLE "userCards" ADD CONSTRAINT "userCards_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
195
+
196
+ -- AddForeignKey
197
+ ALTER TABLE "userCards" ADD CONSTRAINT "userCards_cardId_fkey" FOREIGN KEY ("cardId") REFERENCES "cards"("id") ON DELETE CASCADE ON UPDATE CASCADE;
198
+
199
+ -- AddForeignKey
200
+ ALTER TABLE "userStats" ADD CONSTRAINT "userStats_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
201
+
202
+ -- AddForeignKey
203
+ ALTER TABLE "packs" ADD CONSTRAINT "packs_teacherId_fkey" FOREIGN KEY ("teacherId") REFERENCES "teachers"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
204
+
205
+ -- AddForeignKey
206
+ ALTER TABLE "packs" ADD CONSTRAINT "packs_categoryId_fkey" FOREIGN KEY ("categoryId") REFERENCES "categories"("id") ON DELETE SET NULL ON UPDATE CASCADE;
207
+
208
+ -- AddForeignKey
209
+ ALTER TABLE "users" ADD CONSTRAINT "users_teamId_fkey" FOREIGN KEY ("teamId") REFERENCES "teams"("id") ON DELETE SET NULL ON UPDATE CASCADE;
210
+
211
+ -- AddForeignKey
212
+ ALTER TABLE "achievements" ADD CONSTRAINT "achievements_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
213
+
214
+ -- AddForeignKey
215
+ ALTER TABLE "googleUsers" ADD CONSTRAINT "googleUsers_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
216
+
217
+ -- AddForeignKey
218
+ ALTER TABLE "userAnswers" ADD CONSTRAINT "userAnswers_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
219
+
220
+ -- AddForeignKey
221
+ ALTER TABLE "userAnswers" ADD CONSTRAINT "userAnswers_cardId_fkey" FOREIGN KEY ("cardId") REFERENCES "cards"("id") ON DELETE CASCADE ON UPDATE CASCADE;
222
+
223
+ -- AddForeignKey
224
+ ALTER TABLE "purchases" ADD CONSTRAINT "purchases_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
225
+
226
+ -- AddForeignKey
227
+ ALTER TABLE "purchases" ADD CONSTRAINT "purchases_packId_fkey" FOREIGN KEY ("packId") REFERENCES "packs"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
228
+
229
+ -- AddForeignKey
230
+ ALTER TABLE "_PackToUser" ADD CONSTRAINT "_PackToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "packs"("id") ON DELETE CASCADE ON UPDATE CASCADE;
231
+
232
+ -- AddForeignKey
233
+ ALTER TABLE "_PackToUser" ADD CONSTRAINT "_PackToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
234
+
235
+ -- AddForeignKey
236
+ ALTER TABLE "_PackToTeam" ADD CONSTRAINT "_PackToTeam_A_fkey" FOREIGN KEY ("A") REFERENCES "packs"("id") ON DELETE CASCADE ON UPDATE CASCADE;
237
+
238
+ -- AddForeignKey
239
+ ALTER TABLE "_PackToTeam" ADD CONSTRAINT "_PackToTeam_B_fkey" FOREIGN KEY ("B") REFERENCES "teams"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -1,33 +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;
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;
@@ -1,41 +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";
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";
@@ -1,8 +1,8 @@
1
- /*
2
- Warnings:
3
-
4
- - A unique constraint covering the columns `[purchaseToken]` on the table `purchases` will be added. If there are existing duplicate values, this will fail.
5
-
6
- */
7
- -- CreateIndex
8
- CREATE UNIQUE INDEX "purchases_purchaseToken_key" ON "purchases"("purchaseToken");
1
+ /*
2
+ Warnings:
3
+
4
+ - A unique constraint covering the columns `[purchaseToken]` on the table `purchases` will be added. If there are existing duplicate values, this will fail.
5
+
6
+ */
7
+ -- CreateIndex
8
+ CREATE UNIQUE INDEX "purchases_purchaseToken_key" ON "purchases"("purchaseToken");
@@ -1,2 +1,2 @@
1
- -- AlterEnum
2
- ALTER TYPE "PurchaseState" ADD VALUE 'CANCELED';
1
+ -- AlterEnum
2
+ ALTER TYPE "PurchaseState" ADD VALUE 'CANCELED';
@@ -1,15 +1,15 @@
1
- /*
2
- Warnings:
3
-
4
- - Changed the type of `state` on the `purchases` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
5
-
6
- */
7
- -- CreateEnum
8
- CREATE TYPE "SubscriptionState" AS ENUM ('PENDING', 'COMPLETED', 'REFUNDED', 'FAILED', 'CANCELED');
9
-
10
- -- AlterTable
11
- ALTER TABLE "purchases" DROP COLUMN "state",
12
- ADD COLUMN "state" "SubscriptionState" NOT NULL;
13
-
14
- -- DropEnum
15
- DROP TYPE "PurchaseState";
1
+ /*
2
+ Warnings:
3
+
4
+ - Changed the type of `state` on the `purchases` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required.
5
+
6
+ */
7
+ -- CreateEnum
8
+ CREATE TYPE "SubscriptionState" AS ENUM ('PENDING', 'COMPLETED', 'REFUNDED', 'FAILED', 'CANCELED');
9
+
10
+ -- AlterTable
11
+ ALTER TABLE "purchases" DROP COLUMN "state",
12
+ ADD COLUMN "state" "SubscriptionState" NOT NULL;
13
+
14
+ -- DropEnum
15
+ DROP TYPE "PurchaseState";
@@ -1,32 +1,32 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the `purchases` table. If the table is not empty, all the data it contains will be lost.
5
-
6
- */
7
- -- DropForeignKey
8
- ALTER TABLE "purchases" DROP CONSTRAINT "purchases_userId_fkey";
9
-
10
- -- DropTable
11
- DROP TABLE "purchases";
12
-
13
- -- CreateTable
14
- CREATE TABLE "subscriptions" (
15
- "id" TEXT NOT NULL,
16
- "userId" TEXT NOT NULL,
17
- "purchaseToken" TEXT NOT NULL,
18
- "sku" TEXT NOT NULL,
19
- "state" "SubscriptionState" NOT NULL,
20
- "acknowledged" BOOLEAN NOT NULL,
21
- "expirationDate" TIMESTAMP(3) NOT NULL,
22
- "createdAt" TIMESTAMP(3) NOT NULL,
23
- "updatedAt" TIMESTAMP(3) NOT NULL,
24
-
25
- CONSTRAINT "subscriptions_pkey" PRIMARY KEY ("id")
26
- );
27
-
28
- -- CreateIndex
29
- CREATE UNIQUE INDEX "subscriptions_purchaseToken_key" ON "subscriptions"("purchaseToken");
30
-
31
- -- AddForeignKey
32
- ALTER TABLE "subscriptions" ADD CONSTRAINT "subscriptions_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the `purchases` table. If the table is not empty, all the data it contains will be lost.
5
+
6
+ */
7
+ -- DropForeignKey
8
+ ALTER TABLE "purchases" DROP CONSTRAINT "purchases_userId_fkey";
9
+
10
+ -- DropTable
11
+ DROP TABLE "purchases";
12
+
13
+ -- CreateTable
14
+ CREATE TABLE "subscriptions" (
15
+ "id" TEXT NOT NULL,
16
+ "userId" TEXT NOT NULL,
17
+ "purchaseToken" TEXT NOT NULL,
18
+ "sku" TEXT NOT NULL,
19
+ "state" "SubscriptionState" NOT NULL,
20
+ "acknowledged" BOOLEAN NOT NULL,
21
+ "expirationDate" TIMESTAMP(3) NOT NULL,
22
+ "createdAt" TIMESTAMP(3) NOT NULL,
23
+ "updatedAt" TIMESTAMP(3) NOT NULL,
24
+
25
+ CONSTRAINT "subscriptions_pkey" PRIMARY KEY ("id")
26
+ );
27
+
28
+ -- CreateIndex
29
+ CREATE UNIQUE INDEX "subscriptions_purchaseToken_key" ON "subscriptions"("purchaseToken");
30
+
31
+ -- AddForeignKey
32
+ ALTER TABLE "subscriptions" ADD CONSTRAINT "subscriptions_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -1,10 +1,10 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `expirationDate` on the `subscriptions` table. All the data in the column will be lost.
5
- - Added the required column `expiryTime` to the `subscriptions` table without a default value. This is not possible if the table is not empty.
6
-
7
- */
8
- -- AlterTable
9
- ALTER TABLE "subscriptions" DROP COLUMN "expirationDate",
10
- ADD COLUMN "expiryTime" TIMESTAMP(3) NOT NULL;
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `expirationDate` on the `subscriptions` table. All the data in the column will be lost.
5
+ - Added the required column `expiryTime` to the `subscriptions` table without a default value. This is not possible if the table is not empty.
6
+
7
+ */
8
+ -- AlterTable
9
+ ALTER TABLE "subscriptions" DROP COLUMN "expirationDate",
10
+ ADD COLUMN "expiryTime" TIMESTAMP(3) NOT NULL;
@@ -1,14 +1,14 @@
1
- /*
2
- Warnings:
3
-
4
- - The values [COMPLETED,REFUNDED,FAILED,CANCELED] on the enum `SubscriptionState` will be removed. If these variants are still used in the database, this will fail.
5
-
6
- */
7
- -- AlterEnum
8
- BEGIN;
9
- CREATE TYPE "SubscriptionState_new" AS ENUM ('PENDING', 'ACTIVE', 'INACTIVE');
10
- ALTER TABLE "subscriptions" ALTER COLUMN "state" TYPE "SubscriptionState_new" USING ("state"::text::"SubscriptionState_new");
11
- ALTER TYPE "SubscriptionState" RENAME TO "SubscriptionState_old";
12
- ALTER TYPE "SubscriptionState_new" RENAME TO "SubscriptionState";
13
- DROP TYPE "SubscriptionState_old";
14
- COMMIT;
1
+ /*
2
+ Warnings:
3
+
4
+ - The values [COMPLETED,REFUNDED,FAILED,CANCELED] on the enum `SubscriptionState` will be removed. If these variants are still used in the database, this will fail.
5
+
6
+ */
7
+ -- AlterEnum
8
+ BEGIN;
9
+ CREATE TYPE "SubscriptionState_new" AS ENUM ('PENDING', 'ACTIVE', 'INACTIVE');
10
+ ALTER TABLE "subscriptions" ALTER COLUMN "state" TYPE "SubscriptionState_new" USING ("state"::text::"SubscriptionState_new");
11
+ ALTER TYPE "SubscriptionState" RENAME TO "SubscriptionState_old";
12
+ ALTER TYPE "SubscriptionState_new" RENAME TO "SubscriptionState";
13
+ DROP TYPE "SubscriptionState_old";
14
+ COMMIT;
@@ -1,22 +1,22 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `dailyUsageSec` on the `userStats` table. All the data in the column will be lost.
5
- - You are about to drop the column `monthlyUsageSec` on the `userStats` table. All the data in the column will be lost.
6
- - You are about to drop the column `weeklyUsageSec` on the `userStats` table. All the data in the column will be lost.
7
- - Added the required column `thisMonthActiveDays` to the `userStats` table without a default value. This is not possible if the table is not empty.
8
- - Added the required column `thisMonthActivitySec` to the `userStats` table without a default value. This is not possible if the table is not empty.
9
- - Added the required column `thisWeekActiveDays` to the `userStats` table without a default value. This is not possible if the table is not empty.
10
- - Added the required column `thisWeekActivitySec` to the `userStats` table without a default value. This is not possible if the table is not empty.
11
- - Added the required column `todayActivitySec` to the `userStats` table without a default value. This is not possible if the table is not empty.
12
-
13
- */
14
- -- AlterTable
15
- ALTER TABLE "userStats" DROP COLUMN "dailyUsageSec",
16
- DROP COLUMN "monthlyUsageSec",
17
- DROP COLUMN "weeklyUsageSec",
18
- ADD COLUMN "thisMonthActiveDays" INTEGER NOT NULL,
19
- ADD COLUMN "thisMonthActivitySec" INTEGER NOT NULL,
20
- ADD COLUMN "thisWeekActiveDays" INTEGER NOT NULL,
21
- ADD COLUMN "thisWeekActivitySec" INTEGER NOT NULL,
22
- ADD COLUMN "todayActivitySec" INTEGER NOT NULL;
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `dailyUsageSec` on the `userStats` table. All the data in the column will be lost.
5
+ - You are about to drop the column `monthlyUsageSec` on the `userStats` table. All the data in the column will be lost.
6
+ - You are about to drop the column `weeklyUsageSec` on the `userStats` table. All the data in the column will be lost.
7
+ - Added the required column `thisMonthActiveDays` to the `userStats` table without a default value. This is not possible if the table is not empty.
8
+ - Added the required column `thisMonthActivitySec` to the `userStats` table without a default value. This is not possible if the table is not empty.
9
+ - Added the required column `thisWeekActiveDays` to the `userStats` table without a default value. This is not possible if the table is not empty.
10
+ - Added the required column `thisWeekActivitySec` to the `userStats` table without a default value. This is not possible if the table is not empty.
11
+ - Added the required column `todayActivitySec` to the `userStats` table without a default value. This is not possible if the table is not empty.
12
+
13
+ */
14
+ -- AlterTable
15
+ ALTER TABLE "userStats" DROP COLUMN "dailyUsageSec",
16
+ DROP COLUMN "monthlyUsageSec",
17
+ DROP COLUMN "weeklyUsageSec",
18
+ ADD COLUMN "thisMonthActiveDays" INTEGER NOT NULL,
19
+ ADD COLUMN "thisMonthActivitySec" INTEGER NOT NULL,
20
+ ADD COLUMN "thisWeekActiveDays" INTEGER NOT NULL,
21
+ ADD COLUMN "thisWeekActivitySec" INTEGER NOT NULL,
22
+ ADD COLUMN "todayActivitySec" INTEGER NOT NULL;
@@ -1,16 +1,16 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `subscriptionExpire` on the `users` table. All the data in the column will be lost.
5
- - Added the required column `dailyGoalAchieved` to the `userStats` table without a default value. This is not possible if the table is not empty.
6
- - Added the required column `monthlyGoalAchieved` to the `userStats` table without a default value. This is not possible if the table is not empty.
7
- - Added the required column `weeklyGoalAchieved` to the `userStats` table without a default value. This is not possible if the table is not empty.
8
-
9
- */
10
- -- AlterTable
11
- ALTER TABLE "userStats" ADD COLUMN "dailyGoalAchieved" BOOLEAN NOT NULL,
12
- ADD COLUMN "monthlyGoalAchieved" BOOLEAN NOT NULL,
13
- ADD COLUMN "weeklyGoalAchieved" BOOLEAN NOT NULL;
14
-
15
- -- AlterTable
16
- ALTER TABLE "users" DROP COLUMN "subscriptionExpire";
1
+ /*
2
+ Warnings:
3
+
4
+ - You are about to drop the column `subscriptionExpire` on the `users` table. All the data in the column will be lost.
5
+ - Added the required column `dailyGoalAchieved` to the `userStats` table without a default value. This is not possible if the table is not empty.
6
+ - Added the required column `monthlyGoalAchieved` to the `userStats` table without a default value. This is not possible if the table is not empty.
7
+ - Added the required column `weeklyGoalAchieved` to the `userStats` table without a default value. This is not possible if the table is not empty.
8
+
9
+ */
10
+ -- AlterTable
11
+ ALTER TABLE "userStats" ADD COLUMN "dailyGoalAchieved" BOOLEAN NOT NULL,
12
+ ADD COLUMN "monthlyGoalAchieved" BOOLEAN NOT NULL,
13
+ ADD COLUMN "weeklyGoalAchieved" BOOLEAN NOT NULL;
14
+
15
+ -- AlterTable
16
+ ALTER TABLE "users" DROP COLUMN "subscriptionExpire";
@@ -1,15 +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;
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;
@@ -1,10 +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;
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;
@@ -1,3 +1,3 @@
1
- # Please do not edit this file manually
2
- # It should be added in your version-control system (e.g., Git)
3
- provider = "postgresql"
1
+ # Please do not edit this file manually
2
+ # It should be added in your version-control system (e.g., Git)
3
+ provider = "postgresql"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lang-database",
3
- "version": "17.1.1",
3
+ "version": "18.0.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -24,10 +24,10 @@
24
24
  },
25
25
  "homepage": "https://bitbucket.org/syke80/lang-database#readme",
26
26
  "devDependencies": {
27
- "@prisma/client": "^6.7.0",
28
- "prisma": "^6.7.0"
27
+ "@prisma/client": "^7.5.0",
28
+ "prisma": "^7.5.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "@prisma/client": ">=6.7.0"
31
+ "@prisma/client": ">=7.5.0"
32
32
  }
33
33
  }
@@ -0,0 +1,12 @@
1
+ import "dotenv/config";
2
+ import { defineConfig, env } from "prisma/config";
3
+
4
+ export default defineConfig({
5
+ schema: "schema.prisma",
6
+ migrations: {
7
+ path: "migrations"
8
+ },
9
+ datasource: {
10
+ url: env("DATABASE_URL"),
11
+ },
12
+ });
package/schema.prisma CHANGED
@@ -4,8 +4,6 @@ generator client {
4
4
 
5
5
  datasource db {
6
6
  provider = "postgresql"
7
- url = env("DATABASE_URL")
8
- shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
9
7
  }
10
8
 
11
9
  model Card {