chore(db): migrate from SQLite to PostgreSQL

- Change Prisma provider from sqlite to postgresql
- Replace better-sqlite3 adapter with @prisma/adapter-pg
- Update prisma.config.ts and lib/prisma.ts for PostgreSQL
- Add DATABASE_URL to .env.local
- Regenerate Prisma client for PostgreSQL
- Recreate migrations for PostgreSQL database
This commit is contained in:
jessy-david-dev
2026-04-11 15:50:44 +02:00
parent 5cd32c37e0
commit 875a299cd4
17 changed files with 372 additions and 149 deletions
+34 -32
View File
@@ -16,8 +16,8 @@ import type * as Prisma from "./internal/prismaNamespace"
export type StringFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
in?: string[]
notIn?: string[]
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
lt?: string | Prisma.StringFieldRefInput<$PrismaModel>
lte?: string | Prisma.StringFieldRefInput<$PrismaModel>
gt?: string | Prisma.StringFieldRefInput<$PrismaModel>
@@ -25,6 +25,7 @@ export type StringFilter<$PrismaModel = never> = {
contains?: string | Prisma.StringFieldRefInput<$PrismaModel>
startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
mode?: Prisma.QueryMode
not?: Prisma.NestedStringFilter<$PrismaModel> | string
}
@@ -35,8 +36,8 @@ export type BoolFilter<$PrismaModel = never> = {
export type DateTimeFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
in?: Date[] | string[]
notIn?: Date[] | string[]
in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel>
notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel>
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
@@ -46,8 +47,8 @@ export type DateTimeFilter<$PrismaModel = never> = {
export type StringWithAggregatesFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
in?: string[]
notIn?: string[]
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
lt?: string | Prisma.StringFieldRefInput<$PrismaModel>
lte?: string | Prisma.StringFieldRefInput<$PrismaModel>
gt?: string | Prisma.StringFieldRefInput<$PrismaModel>
@@ -55,6 +56,7 @@ export type StringWithAggregatesFilter<$PrismaModel = never> = {
contains?: string | Prisma.StringFieldRefInput<$PrismaModel>
startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel>
mode?: Prisma.QueryMode
not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string
_count?: Prisma.NestedIntFilter<$PrismaModel>
_min?: Prisma.NestedStringFilter<$PrismaModel>
@@ -71,8 +73,8 @@ export type BoolWithAggregatesFilter<$PrismaModel = never> = {
export type DateTimeWithAggregatesFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
in?: Date[] | string[]
notIn?: Date[] | string[]
in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel>
notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel>
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
@@ -85,8 +87,8 @@ export type DateTimeWithAggregatesFilter<$PrismaModel = never> = {
export type IntFilter<$PrismaModel = never> = {
equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
in?: number[]
notIn?: number[]
in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
@@ -96,8 +98,8 @@ export type IntFilter<$PrismaModel = never> = {
export type FloatFilter<$PrismaModel = never> = {
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
in?: number[]
notIn?: number[]
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
@@ -107,8 +109,8 @@ export type FloatFilter<$PrismaModel = never> = {
export type IntWithAggregatesFilter<$PrismaModel = never> = {
equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
in?: number[]
notIn?: number[]
in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
@@ -123,8 +125,8 @@ export type IntWithAggregatesFilter<$PrismaModel = never> = {
export type FloatWithAggregatesFilter<$PrismaModel = never> = {
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
in?: number[]
notIn?: number[]
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
@@ -139,8 +141,8 @@ export type FloatWithAggregatesFilter<$PrismaModel = never> = {
export type NestedStringFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
in?: string[]
notIn?: string[]
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
lt?: string | Prisma.StringFieldRefInput<$PrismaModel>
lte?: string | Prisma.StringFieldRefInput<$PrismaModel>
gt?: string | Prisma.StringFieldRefInput<$PrismaModel>
@@ -158,8 +160,8 @@ export type NestedBoolFilter<$PrismaModel = never> = {
export type NestedDateTimeFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
in?: Date[] | string[]
notIn?: Date[] | string[]
in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel>
notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel>
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
@@ -169,8 +171,8 @@ export type NestedDateTimeFilter<$PrismaModel = never> = {
export type NestedStringWithAggregatesFilter<$PrismaModel = never> = {
equals?: string | Prisma.StringFieldRefInput<$PrismaModel>
in?: string[]
notIn?: string[]
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel>
lt?: string | Prisma.StringFieldRefInput<$PrismaModel>
lte?: string | Prisma.StringFieldRefInput<$PrismaModel>
gt?: string | Prisma.StringFieldRefInput<$PrismaModel>
@@ -186,8 +188,8 @@ export type NestedStringWithAggregatesFilter<$PrismaModel = never> = {
export type NestedIntFilter<$PrismaModel = never> = {
equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
in?: number[]
notIn?: number[]
in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
@@ -205,8 +207,8 @@ export type NestedBoolWithAggregatesFilter<$PrismaModel = never> = {
export type NestedDateTimeWithAggregatesFilter<$PrismaModel = never> = {
equals?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
in?: Date[] | string[]
notIn?: Date[] | string[]
in?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel>
notIn?: Date[] | string[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel>
lt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
lte?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
gt?: Date | string | Prisma.DateTimeFieldRefInput<$PrismaModel>
@@ -219,8 +221,8 @@ export type NestedDateTimeWithAggregatesFilter<$PrismaModel = never> = {
export type NestedFloatFilter<$PrismaModel = never> = {
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
in?: number[]
notIn?: number[]
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
@@ -230,8 +232,8 @@ export type NestedFloatFilter<$PrismaModel = never> = {
export type NestedIntWithAggregatesFilter<$PrismaModel = never> = {
equals?: number | Prisma.IntFieldRefInput<$PrismaModel>
in?: number[]
notIn?: number[]
in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel>
lt?: number | Prisma.IntFieldRefInput<$PrismaModel>
lte?: number | Prisma.IntFieldRefInput<$PrismaModel>
gt?: number | Prisma.IntFieldRefInput<$PrismaModel>
@@ -246,8 +248,8 @@ export type NestedIntWithAggregatesFilter<$PrismaModel = never> = {
export type NestedFloatWithAggregatesFilter<$PrismaModel = never> = {
equals?: number | Prisma.FloatFieldRefInput<$PrismaModel>
in?: number[]
notIn?: number[]
in?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
notIn?: number[] | Prisma.ListFloatFieldRefInput<$PrismaModel>
lt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
lte?: number | Prisma.FloatFieldRefInput<$PrismaModel>
gt?: number | Prisma.FloatFieldRefInput<$PrismaModel>
+4 -4
View File
@@ -19,8 +19,8 @@ const config: runtime.GetPrismaClientConfig = {
"previewFeatures": [],
"clientVersion": "7.7.0",
"engineVersion": "75cbdc1eb7150937890ad5465d861175c6624711",
"activeProvider": "sqlite",
"inlineSchema": "generator client {\n provider = \"prisma-client\"\n output = \"../lib/generated/prisma\"\n}\n\ndatasource db {\n provider = \"sqlite\"\n}\n\nmodel User {\n id String @id @default(uuid(7))\n name String\n email String @unique\n password String\n banned Boolean @default(false)\n createdAt DateTime @default(now())\n games Game[]\n dailyResults DailyResult[]\n}\n\nmodel Game {\n id String @id @default(uuid(7))\n userId String\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n mode String // \"solo\" | \"multi\" | \"daily\" | \"blitz\"\n startArticle String\n targetArticle String\n path String // JSON array de titres\n clicks Int\n timeSeconds Float\n won Boolean @default(true)\n playedAt DateTime @default(now())\n\n @@index([userId])\n}\n\nmodel DailyPuzzle {\n id String @id @default(uuid(7))\n date String @unique // \"YYYY-MM-DD\"\n startArticle String\n targetArticle String\n results DailyResult[]\n}\n\nmodel DailyResult {\n id String @id @default(uuid(7))\n puzzleId String\n puzzle DailyPuzzle @relation(fields: [puzzleId], references: [id], onDelete: Cascade)\n userId String\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n path String // JSON\n clicks Int\n timeSeconds Float\n won Boolean\n playedAt DateTime @default(now())\n\n @@unique([puzzleId, userId])\n @@index([puzzleId])\n}\n",
"activeProvider": "postgresql",
"inlineSchema": "generator client {\n provider = \"prisma-client\"\n output = \"../lib/generated/prisma\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n}\n\nmodel User {\n id String @id @default(uuid(7))\n name String\n email String @unique\n password String\n banned Boolean @default(false)\n createdAt DateTime @default(now())\n games Game[]\n dailyResults DailyResult[]\n}\n\nmodel Game {\n id String @id @default(uuid(7))\n userId String\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n mode String // \"solo\" | \"multi\" | \"daily\" | \"blitz\"\n startArticle String\n targetArticle String\n path String // JSON array de titres\n clicks Int\n timeSeconds Float\n won Boolean @default(true)\n playedAt DateTime @default(now())\n\n @@index([userId])\n}\n\nmodel DailyPuzzle {\n id String @id @default(uuid(7))\n date String @unique // \"YYYY-MM-DD\"\n startArticle String\n targetArticle String\n results DailyResult[]\n}\n\nmodel DailyResult {\n id String @id @default(uuid(7))\n puzzleId String\n puzzle DailyPuzzle @relation(fields: [puzzleId], references: [id], onDelete: Cascade)\n userId String\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n path String // JSON\n clicks Int\n timeSeconds Float\n won Boolean\n playedAt DateTime @default(now())\n\n @@unique([puzzleId, userId])\n @@index([puzzleId])\n}\n",
"runtimeDataModel": {
"models": {},
"enums": {},
@@ -45,10 +45,10 @@ async function decodeBase64AsWasm(wasmBase64: string): Promise<WebAssembly.Modul
}
config.compilerWasm = {
getRuntime: async () => await import("@prisma/client/runtime/query_compiler_fast_bg.sqlite.mjs"),
getRuntime: async () => await import("@prisma/client/runtime/query_compiler_fast_bg.postgresql.mjs"),
getQueryCompilerWasmModule: async () => {
const { wasm } = await import("@prisma/client/runtime/query_compiler_fast_bg.sqlite.wasm-base64.mjs")
const { wasm } = await import("@prisma/client/runtime/query_compiler_fast_bg.postgresql.wasm-base64.mjs")
return await decodeBase64AsWasm(wasm)
},
@@ -733,6 +733,9 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
*/
export const TransactionIsolationLevel = runtime.makeStrictEnum({
ReadUncommitted: 'ReadUncommitted',
ReadCommitted: 'ReadCommitted',
RepeatableRead: 'RepeatableRead',
Serializable: 'Serializable'
} as const)
@@ -799,6 +802,14 @@ export const SortOrder = {
export type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]
export const QueryMode = {
default: 'default',
insensitive: 'insensitive'
} as const
export type QueryMode = (typeof QueryMode)[keyof typeof QueryMode]
/**
* Field references
@@ -812,6 +823,13 @@ export type StringFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel,
/**
* Reference to a field of type 'String[]'
*/
export type ListStringFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'String[]'>
/**
* Reference to a field of type 'Boolean'
*/
@@ -826,6 +844,13 @@ export type DateTimeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel
/**
* Reference to a field of type 'DateTime[]'
*/
export type ListDateTimeFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'DateTime[]'>
/**
* Reference to a field of type 'Int'
*/
@@ -833,12 +858,26 @@ export type IntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'In
/**
* Reference to a field of type 'Int[]'
*/
export type ListIntFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Int[]'>
/**
* Reference to a field of type 'Float'
*/
export type FloatFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Float'>
/**
* Reference to a field of type 'Float[]'
*/
export type ListFloatFieldRefInput<$PrismaModel> = FieldRefInputType<$PrismaModel, 'Float[]'>
/**
* Batch Payload for updateMany & deleteMany & createMany
*/
@@ -64,6 +64,9 @@ export type ModelName = (typeof ModelName)[keyof typeof ModelName]
*/
export const TransactionIsolationLevel = runtime.makeStrictEnum({
ReadUncommitted: 'ReadUncommitted',
ReadCommitted: 'ReadCommitted',
RepeatableRead: 'RepeatableRead',
Serializable: 'Serializable'
} as const)
@@ -129,3 +132,11 @@ export const SortOrder = {
export type SortOrder = (typeof SortOrder)[keyof typeof SortOrder]
export const QueryMode = {
default: 'default',
insensitive: 'insensitive'
} as const
export type QueryMode = (typeof QueryMode)[keyof typeof QueryMode]
@@ -1094,6 +1094,7 @@ export type DailyPuzzleCreateManyArgs<ExtArgs extends runtime.Types.Extensions.I
* The data used to create many DailyPuzzles.
*/
data: Prisma.DailyPuzzleCreateManyInput | Prisma.DailyPuzzleCreateManyInput[]
skipDuplicates?: boolean
}
/**
@@ -1112,6 +1113,7 @@ export type DailyPuzzleCreateManyAndReturnArgs<ExtArgs extends runtime.Types.Ext
* The data used to create many DailyPuzzles.
*/
data: Prisma.DailyPuzzleCreateManyInput | Prisma.DailyPuzzleCreateManyInput[]
skipDuplicates?: boolean
}
/**
@@ -552,6 +552,7 @@ export type DailyResultCreateOrConnectWithoutUserInput = {
export type DailyResultCreateManyUserInputEnvelope = {
data: Prisma.DailyResultCreateManyUserInput | Prisma.DailyResultCreateManyUserInput[]
skipDuplicates?: boolean
}
export type DailyResultUpsertWithWhereUniqueWithoutUserInput = {
@@ -611,6 +612,7 @@ export type DailyResultCreateOrConnectWithoutPuzzleInput = {
export type DailyResultCreateManyPuzzleInputEnvelope = {
data: Prisma.DailyResultCreateManyPuzzleInput | Prisma.DailyResultCreateManyPuzzleInput[]
skipDuplicates?: boolean
}
export type DailyResultUpsertWithWhereUniqueWithoutPuzzleInput = {
@@ -1457,6 +1459,7 @@ export type DailyResultCreateManyArgs<ExtArgs extends runtime.Types.Extensions.I
* The data used to create many DailyResults.
*/
data: Prisma.DailyResultCreateManyInput | Prisma.DailyResultCreateManyInput[]
skipDuplicates?: boolean
}
/**
@@ -1475,6 +1478,7 @@ export type DailyResultCreateManyAndReturnArgs<ExtArgs extends runtime.Types.Ext
* The data used to create many DailyResults.
*/
data: Prisma.DailyResultCreateManyInput | Prisma.DailyResultCreateManyInput[]
skipDuplicates?: boolean
/**
* Choose, which related nodes to fetch as well
*/
+3
View File
@@ -566,6 +566,7 @@ export type GameCreateOrConnectWithoutUserInput = {
export type GameCreateManyUserInputEnvelope = {
data: Prisma.GameCreateManyUserInput | Prisma.GameCreateManyUserInput[]
skipDuplicates?: boolean
}
export type GameUpsertWithWhereUniqueWithoutUserInput = {
@@ -1400,6 +1401,7 @@ export type GameCreateManyArgs<ExtArgs extends runtime.Types.Extensions.Internal
* The data used to create many Games.
*/
data: Prisma.GameCreateManyInput | Prisma.GameCreateManyInput[]
skipDuplicates?: boolean
}
/**
@@ -1418,6 +1420,7 @@ export type GameCreateManyAndReturnArgs<ExtArgs extends runtime.Types.Extensions
* The data used to create many Games.
*/
data: Prisma.GameCreateManyInput | Prisma.GameCreateManyInput[]
skipDuplicates?: boolean
/**
* Choose, which related nodes to fetch as well
*/
+2
View File
@@ -1264,6 +1264,7 @@ export type UserCreateManyArgs<ExtArgs extends runtime.Types.Extensions.Internal
* The data used to create many Users.
*/
data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[]
skipDuplicates?: boolean
}
/**
@@ -1282,6 +1283,7 @@ export type UserCreateManyAndReturnArgs<ExtArgs extends runtime.Types.Extensions
* The data used to create many Users.
*/
data: Prisma.UserCreateManyInput | Prisma.UserCreateManyInput[]
skipDuplicates?: boolean
}
/**
+4 -3
View File
@@ -1,11 +1,12 @@
import Database from "better-sqlite3";
import { PrismaBetterSqlite3 } from "@prisma/adapter-better-sqlite3";
import { Pool } from "pg";
import { PrismaPg } from "@prisma/adapter-pg";
import { PrismaClient } from "./generated/prisma/client";
const globalForPrisma = globalThis as unknown as { prisma?: PrismaClient };
function createPrisma() {
const adapter = new PrismaBetterSqlite3({ url: "./wikirush.db" });
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const adapter = new PrismaPg(pool);
return new PrismaClient({ adapter });
}
+2 -2
View File
@@ -13,24 +13,24 @@
},
"dependencies": {
"@panva/hkdf": "^1.2.1",
"@prisma/adapter-pg": "^7.7.0",
"@prisma/client": "^7.7.0",
"bcryptjs": "^3.0.3",
"jose": "^6.2.2",
"next": "16.2.3",
"next-auth": "5.0.0-beta.30",
"pg": "^8.20.0",
"react": "19.2.4",
"react-dom": "19.2.4",
"simple-icons": "^16.15.0"
},
"devDependencies": {
"@prisma/adapter-better-sqlite3": "^7.7.0",
"@tailwindcss/postcss": "^4",
"@types/bcryptjs": "^3.0.0",
"@types/better-sqlite3": "^7.6.13",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"better-sqlite3": "12",
"eslint": "^9",
"eslint-config-next": "16.2.3",
"prisma": "7",
+189 -28
View File
@@ -11,6 +11,9 @@ importers:
'@panva/hkdf':
specifier: ^1.2.1
version: 1.2.1
'@prisma/adapter-pg':
specifier: ^7.7.0
version: 7.7.0
'@prisma/client':
specifier: ^7.7.0
version: 7.7.0(prisma@7.7.0(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(better-sqlite3@12.8.0)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(typescript@5.9.3))(typescript@5.9.3)
@@ -26,6 +29,9 @@ importers:
next-auth:
specifier: 5.0.0-beta.30
version: 5.0.0-beta.30(next@16.2.3(@babel/core@7.29.0)(react-dom@19.2.4(react@19.2.4))(react@19.2.4))(react@19.2.4)
pg:
specifier: ^8.20.0
version: 8.20.0
react:
specifier: 19.2.4
version: 19.2.4
@@ -36,9 +42,6 @@ importers:
specifier: ^16.15.0
version: 16.15.0
devDependencies:
'@prisma/adapter-better-sqlite3':
specifier: ^7.7.0
version: 7.7.0
'@tailwindcss/postcss':
specifier: ^4
version: 4.2.2
@@ -57,9 +60,6 @@ importers:
'@types/react-dom':
specifier: ^19
version: 19.2.3(@types/react@19.2.14)
better-sqlite3:
specifier: '12'
version: 12.8.0
eslint:
specifier: ^9
version: 9.39.4(jiti@2.6.1)
@@ -478,8 +478,8 @@ packages:
'@panva/hkdf@1.2.1':
resolution: {integrity: sha512-6oclG6Y3PiDFcoyk8srjLfVKyMfVCKJ27JwNPViuXziFpmdz+MZnZN/aKY0JGXgYuO/VghU0jcOAZgWXZ1Dmrw==}
'@prisma/adapter-better-sqlite3@7.7.0':
resolution: {integrity: sha512-K6V9AHEKBBC/zo5gXb3PO5A0dYv/fSpCRMnbKY9lpB7B+02MdLSVVP6JtMpLD+NcPDQxKvKACJO7n+zZH4hA5g==}
'@prisma/adapter-pg@7.7.0':
resolution: {integrity: sha512-q33Ta8sKbgzEpAy0lx45tAq//yMv0qcb+8nj+TCA3P4wiAY+OBFEFk/NDkZncAfHaNJeGo5WJpJdpbL+ijYx8g==}
'@prisma/client-runtime-utils@7.7.0':
resolution: {integrity: sha512-BLyd0UpFYOtyJFTHm7jS9vesHW7P83abibodQMiIofqjBKzDHQ1VAsQkdfvXyYDkPlONPfOTz7/rv3x/+CQqvQ==}
@@ -734,6 +734,9 @@ packages:
'@types/node@20.19.39':
resolution: {integrity: sha512-orrrD74MBUyK8jOAD/r0+lfa1I2MO6I+vAkmAWzMYbCcgrN4lCrmK52gRFQq/JRxfYPfonkr4b0jcY7Olqdqbw==}
'@types/pg@8.20.0':
resolution: {integrity: sha512-bEPFOaMAHTEP1EzpvHTbmwR8UsFyHSKsRisLIHVMXnpNefSbGA1bD6CVy+qKjGSqmZqNqBDV2azOBo8TgkcVow==}
'@types/react-dom@19.2.3':
resolution: {integrity: sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==}
peerDependencies:
@@ -2054,6 +2057,40 @@ packages:
perfect-debounce@1.0.0:
resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==}
pg-cloudflare@1.3.0:
resolution: {integrity: sha512-6lswVVSztmHiRtD6I8hw4qP/nDm1EJbKMRhf3HCYaqud7frGysPv7FYJ5noZQdhQtN2xJnimfMtvQq21pdbzyQ==}
pg-connection-string@2.12.0:
resolution: {integrity: sha512-U7qg+bpswf3Cs5xLzRqbXbQl85ng0mfSV/J0nnA31MCLgvEaAo7CIhmeyrmJpOr7o+zm0rXK+hNnT5l9RHkCkQ==}
pg-int8@1.0.1:
resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==}
engines: {node: '>=4.0.0'}
pg-pool@3.13.0:
resolution: {integrity: sha512-gB+R+Xud1gLFuRD/QgOIgGOBE2KCQPaPwkzBBGC9oG69pHTkhQeIuejVIk3/cnDyX39av2AxomQiyPT13WKHQA==}
peerDependencies:
pg: '>=8.0'
pg-protocol@1.13.0:
resolution: {integrity: sha512-zzdvXfS6v89r6v7OcFCHfHlyG/wvry1ALxZo4LqgUoy7W9xhBDMaqOuMiF3qEV45VqsN6rdlcehHrfDtlCPc8w==}
pg-types@2.2.0:
resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==}
engines: {node: '>=4'}
pg@8.20.0:
resolution: {integrity: sha512-ldhMxz2r8fl/6QkXnBD3CR9/xg694oT6DZQ2s6c/RI28OjtSOpxnPrUCGOBJ46RCUxcWdx3p6kw/xnDHjKvaRA==}
engines: {node: '>= 16.0.0'}
peerDependencies:
pg-native: '>=3.0.1'
peerDependenciesMeta:
pg-native:
optional: true
pgpass@1.0.5:
resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==}
picocolors@1.1.1:
resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}
@@ -2080,6 +2117,26 @@ packages:
resolution: {integrity: sha512-7a70Nsot+EMX9fFU3064K/kdHWZqGVY+BADLyXc8Dfv+mTLLVl6JzJpPaCZ2kQL9gIJvKXSLMHhqdRRjwQeFtw==}
engines: {node: ^10 || ^12 || >=14}
postgres-array@2.0.0:
resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==}
engines: {node: '>=4'}
postgres-array@3.0.4:
resolution: {integrity: sha512-nAUSGfSDGOaOAEGwqsRY27GPOea7CNipJPOA7lPbdEpx5Kg3qzdP0AaWC5MlhTWV9s4hFX39nomVZ+C4tnGOJQ==}
engines: {node: '>=12'}
postgres-bytea@1.0.1:
resolution: {integrity: sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==}
engines: {node: '>=0.10.0'}
postgres-date@1.0.7:
resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==}
engines: {node: '>=0.10.0'}
postgres-interval@1.2.0:
resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==}
engines: {node: '>=0.10.0'}
postgres@3.4.7:
resolution: {integrity: sha512-Jtc2612XINuBjIl/QTWsV5UvE8UHuNblcO3vVADSrKsrc6RqGX6lOW1cEo3CM2v0XG4Nat8nI+YM7/f26VxXLw==}
engines: {node: '>=12'}
@@ -2293,6 +2350,10 @@ packages:
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
engines: {node: '>=0.10.0'}
split2@4.2.0:
resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==}
engines: {node: '>= 10.x'}
sqlstring@2.3.3:
resolution: {integrity: sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==}
engines: {node: '>= 0.6'}
@@ -2497,6 +2558,10 @@ packages:
wrappy@1.0.2:
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
xtend@4.0.2:
resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==}
engines: {node: '>=0.4'}
yallist@3.1.1:
resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
@@ -2886,10 +2951,14 @@ snapshots:
'@panva/hkdf@1.2.1': {}
'@prisma/adapter-better-sqlite3@7.7.0':
'@prisma/adapter-pg@7.7.0':
dependencies:
'@prisma/driver-adapter-utils': 7.7.0
better-sqlite3: 12.8.0
'@types/pg': 8.20.0
pg: 8.20.0
postgres-array: 3.0.4
transitivePeerDependencies:
- pg-native
'@prisma/client-runtime-utils@7.7.0': {}
@@ -3137,6 +3206,12 @@ snapshots:
dependencies:
undici-types: 6.21.0
'@types/pg@8.20.0':
dependencies:
'@types/node': 20.19.39
pg-protocol: 1.13.0
pg-types: 2.2.0
'@types/react-dom@19.2.3(@types/react@19.2.14)':
dependencies:
'@types/react': 19.2.14
@@ -3408,7 +3483,8 @@ snapshots:
balanced-match@4.0.4: {}
base64-js@1.5.1: {}
base64-js@1.5.1:
optional: true
baseline-browser-mapping@2.10.17: {}
@@ -3420,16 +3496,19 @@ snapshots:
dependencies:
bindings: 1.5.0
prebuild-install: 7.1.3
optional: true
bindings@1.5.0:
dependencies:
file-uri-to-path: 1.0.0
optional: true
bl@4.1.0:
dependencies:
buffer: 5.7.1
inherits: 2.0.4
readable-stream: 3.6.2
optional: true
brace-expansion@1.1.13:
dependencies:
@@ -3456,6 +3535,7 @@ snapshots:
dependencies:
base64-js: 1.5.1
ieee754: 1.2.1
optional: true
c12@3.1.0:
dependencies:
@@ -3506,7 +3586,8 @@ snapshots:
dependencies:
readdirp: 4.1.2
chownr@1.1.4: {}
chownr@1.1.4:
optional: true
citty@0.1.6:
dependencies:
@@ -3569,8 +3650,10 @@ snapshots:
decompress-response@6.0.0:
dependencies:
mimic-response: 3.1.0
optional: true
deep-extend@0.6.0: {}
deep-extend@0.6.0:
optional: true
deep-is@0.1.4: {}
@@ -3622,6 +3705,7 @@ snapshots:
end-of-stream@1.4.5:
dependencies:
once: 1.4.0
optional: true
enhanced-resolve@5.20.1:
dependencies:
@@ -3940,7 +4024,8 @@ snapshots:
esutils@2.0.3: {}
expand-template@2.0.3: {}
expand-template@2.0.3:
optional: true
exsolve@1.0.8: {}
@@ -3976,7 +4061,8 @@ snapshots:
dependencies:
flat-cache: 4.0.1
file-uri-to-path@1.0.0: {}
file-uri-to-path@1.0.0:
optional: true
fill-range@7.1.1:
dependencies:
@@ -4003,7 +4089,8 @@ snapshots:
cross-spawn: 7.0.6
signal-exit: 4.1.0
fs-constants@1.0.0: {}
fs-constants@1.0.0:
optional: true
function-bind@1.1.2: {}
@@ -4065,7 +4152,8 @@ snapshots:
nypm: 0.6.5
pathe: 2.0.3
github-from-package@0.0.0: {}
github-from-package@0.0.0:
optional: true
glob-parent@5.1.2:
dependencies:
@@ -4128,7 +4216,8 @@ snapshots:
dependencies:
safer-buffer: 2.1.2
ieee754@1.2.1: {}
ieee754@1.2.1:
optional: true
ignore@5.3.2: {}
@@ -4141,9 +4230,11 @@ snapshots:
imurmurhash@0.1.4: {}
inherits@2.0.4: {}
inherits@2.0.4:
optional: true
ini@1.3.8: {}
ini@1.3.8:
optional: true
internal-slot@1.1.0:
dependencies:
@@ -4406,7 +4497,8 @@ snapshots:
braces: 3.0.3
picomatch: 2.3.2
mimic-response@3.1.0: {}
mimic-response@3.1.0:
optional: true
minimatch@10.2.5:
dependencies:
@@ -4418,7 +4510,8 @@ snapshots:
minimist@1.2.8: {}
mkdirp-classic@0.5.3: {}
mkdirp-classic@0.5.3:
optional: true
ms@2.1.3: {}
@@ -4440,7 +4533,8 @@ snapshots:
nanoid@3.3.11: {}
napi-build-utils@2.0.0: {}
napi-build-utils@2.0.0:
optional: true
napi-postinstall@0.3.4: {}
@@ -4479,6 +4573,7 @@ snapshots:
node-abi@3.89.0:
dependencies:
semver: 7.7.4
optional: true
node-exports-info@1.6.0:
dependencies:
@@ -4546,6 +4641,7 @@ snapshots:
once@1.4.0:
dependencies:
wrappy: 1.0.2
optional: true
optionator@0.9.4:
dependencies:
@@ -4584,6 +4680,41 @@ snapshots:
perfect-debounce@1.0.0: {}
pg-cloudflare@1.3.0:
optional: true
pg-connection-string@2.12.0: {}
pg-int8@1.0.1: {}
pg-pool@3.13.0(pg@8.20.0):
dependencies:
pg: 8.20.0
pg-protocol@1.13.0: {}
pg-types@2.2.0:
dependencies:
pg-int8: 1.0.1
postgres-array: 2.0.0
postgres-bytea: 1.0.1
postgres-date: 1.0.7
postgres-interval: 1.2.0
pg@8.20.0:
dependencies:
pg-connection-string: 2.12.0
pg-pool: 3.13.0(pg@8.20.0)
pg-protocol: 1.13.0
pg-types: 2.2.0
pgpass: 1.0.5
optionalDependencies:
pg-cloudflare: 1.3.0
pgpass@1.0.5:
dependencies:
split2: 4.2.0
picocolors@1.1.1: {}
picomatch@2.3.2: {}
@@ -4610,6 +4741,18 @@ snapshots:
picocolors: 1.1.1
source-map-js: 1.2.1
postgres-array@2.0.0: {}
postgres-array@3.0.4: {}
postgres-bytea@1.0.1: {}
postgres-date@1.0.7: {}
postgres-interval@1.2.0:
dependencies:
xtend: 4.0.2
postgres@3.4.7: {}
preact-render-to-string@6.5.11(preact@10.24.3):
@@ -4632,6 +4775,7 @@ snapshots:
simple-get: 4.0.1
tar-fs: 2.1.4
tunnel-agent: 0.6.0
optional: true
prelude-ls@1.2.1: {}
@@ -4669,6 +4813,7 @@ snapshots:
dependencies:
end-of-stream: 1.4.5
once: 1.4.0
optional: true
punycode@2.3.1: {}
@@ -4687,6 +4832,7 @@ snapshots:
ini: 1.3.8
minimist: 1.2.8
strip-json-comments: 2.0.1
optional: true
react-dom@19.2.4(react@19.2.4):
dependencies:
@@ -4702,6 +4848,7 @@ snapshots:
inherits: 2.0.4
string_decoder: 1.3.0
util-deprecate: 1.0.2
optional: true
readdirp@4.1.2: {}
@@ -4758,7 +4905,8 @@ snapshots:
has-symbols: 1.1.0
isarray: 2.0.5
safe-buffer@5.2.1: {}
safe-buffer@5.2.1:
optional: true
safe-push-apply@1.0.0:
dependencies:
@@ -4873,18 +5021,22 @@ snapshots:
signal-exit@4.1.0: {}
simple-concat@1.0.1: {}
simple-concat@1.0.1:
optional: true
simple-get@4.0.1:
dependencies:
decompress-response: 6.0.0
once: 1.4.0
simple-concat: 1.0.1
optional: true
simple-icons@16.15.0: {}
source-map-js@1.2.1: {}
split2@4.2.0: {}
sqlstring@2.3.3: {}
stable-hash@0.0.5: {}
@@ -4949,10 +5101,12 @@ snapshots:
string_decoder@1.3.0:
dependencies:
safe-buffer: 5.2.1
optional: true
strip-bom@3.0.0: {}
strip-json-comments@2.0.1: {}
strip-json-comments@2.0.1:
optional: true
strip-json-comments@3.1.1: {}
@@ -4979,6 +5133,7 @@ snapshots:
mkdirp-classic: 0.5.3
pump: 3.0.4
tar-stream: 2.2.0
optional: true
tar-stream@2.2.0:
dependencies:
@@ -4987,6 +5142,7 @@ snapshots:
fs-constants: 1.0.0
inherits: 2.0.4
readable-stream: 3.6.2
optional: true
tinyexec@1.1.1: {}
@@ -5015,6 +5171,7 @@ snapshots:
tunnel-agent@0.6.0:
dependencies:
safe-buffer: 5.2.1
optional: true
type-check@0.4.0:
dependencies:
@@ -5109,7 +5266,8 @@ snapshots:
dependencies:
punycode: 2.3.1
util-deprecate@1.0.2: {}
util-deprecate@1.0.2:
optional: true
valibot@1.2.0(typescript@5.9.3):
optionalDependencies:
@@ -5162,7 +5320,10 @@ snapshots:
word-wrap@1.2.5: {}
wrappy@1.0.2: {}
wrappy@1.0.2:
optional: true
xtend@4.0.2: {}
yallist@3.1.1: {}
+1 -1
View File
@@ -4,7 +4,7 @@ const config = {
path: "prisma/migrations",
},
datasource: {
url: "file:./wikirush.db",
url: process.env.DATABASE_URL!,
},
};
@@ -1,60 +0,0 @@
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL PRIMARY KEY,
"name" TEXT NOT NULL,
"email" TEXT NOT NULL,
"password" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);
-- CreateTable
CREATE TABLE "Game" (
"id" TEXT NOT NULL PRIMARY KEY,
"userId" TEXT NOT NULL,
"mode" TEXT NOT NULL,
"startArticle" TEXT NOT NULL,
"targetArticle" TEXT NOT NULL,
"path" TEXT NOT NULL,
"clicks" INTEGER NOT NULL,
"timeSeconds" REAL NOT NULL,
"won" BOOLEAN NOT NULL DEFAULT true,
"playedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Game_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "DailyPuzzle" (
"id" TEXT NOT NULL PRIMARY KEY,
"date" TEXT NOT NULL,
"startArticle" TEXT NOT NULL,
"targetArticle" TEXT NOT NULL
);
-- CreateTable
CREATE TABLE "DailyResult" (
"id" TEXT NOT NULL PRIMARY KEY,
"puzzleId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"path" TEXT NOT NULL,
"clicks" INTEGER NOT NULL,
"timeSeconds" REAL NOT NULL,
"won" BOOLEAN NOT NULL,
"playedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "DailyResult_puzzleId_fkey" FOREIGN KEY ("puzzleId") REFERENCES "DailyPuzzle" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "DailyResult_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
-- CreateIndex
CREATE INDEX "Game_userId_idx" ON "Game"("userId");
-- CreateIndex
CREATE UNIQUE INDEX "DailyPuzzle_date_key" ON "DailyPuzzle"("date");
-- CreateIndex
CREATE INDEX "DailyResult_puzzleId_idx" ON "DailyResult"("puzzleId");
-- CreateIndex
CREATE UNIQUE INDEX "DailyResult_puzzleId_userId_key" ON "DailyResult"("puzzleId", "userId");
@@ -1,17 +0,0 @@
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_User" (
"id" TEXT NOT NULL PRIMARY KEY,
"name" TEXT NOT NULL,
"email" TEXT NOT NULL,
"password" TEXT NOT NULL,
"banned" BOOLEAN NOT NULL DEFAULT false,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO "new_User" ("createdAt", "email", "id", "name", "password") SELECT "createdAt", "email", "id", "name", "password" FROM "User";
DROP TABLE "User";
ALTER TABLE "new_User" RENAME TO "User";
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;
@@ -0,0 +1,75 @@
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"email" TEXT NOT NULL,
"password" TEXT NOT NULL,
"banned" BOOLEAN NOT NULL DEFAULT false,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Game" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"mode" TEXT NOT NULL,
"startArticle" TEXT NOT NULL,
"targetArticle" TEXT NOT NULL,
"path" TEXT NOT NULL,
"clicks" INTEGER NOT NULL,
"timeSeconds" DOUBLE PRECISION NOT NULL,
"won" BOOLEAN NOT NULL DEFAULT true,
"playedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Game_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "DailyPuzzle" (
"id" TEXT NOT NULL,
"date" TEXT NOT NULL,
"startArticle" TEXT NOT NULL,
"targetArticle" TEXT NOT NULL,
CONSTRAINT "DailyPuzzle_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "DailyResult" (
"id" TEXT NOT NULL,
"puzzleId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"path" TEXT NOT NULL,
"clicks" INTEGER NOT NULL,
"timeSeconds" DOUBLE PRECISION NOT NULL,
"won" BOOLEAN NOT NULL,
"playedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "DailyResult_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
-- CreateIndex
CREATE INDEX "Game_userId_idx" ON "Game"("userId");
-- CreateIndex
CREATE UNIQUE INDEX "DailyPuzzle_date_key" ON "DailyPuzzle"("date");
-- CreateIndex
CREATE INDEX "DailyResult_puzzleId_idx" ON "DailyResult"("puzzleId");
-- CreateIndex
CREATE UNIQUE INDEX "DailyResult_puzzleId_userId_key" ON "DailyResult"("puzzleId", "userId");
-- AddForeignKey
ALTER TABLE "Game" ADD CONSTRAINT "Game_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "DailyResult" ADD CONSTRAINT "DailyResult_puzzleId_fkey" FOREIGN KEY ("puzzleId") REFERENCES "DailyPuzzle"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "DailyResult" ADD CONSTRAINT "DailyResult_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
+1 -1
View File
@@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "sqlite"
provider = "postgresql"
+1 -1
View File
@@ -4,7 +4,7 @@ generator client {
}
datasource db {
provider = "sqlite"
provider = "postgresql"
}
model User {