trucoshi 2.5.4 → 4.0.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.
@@ -1,82 +0,0 @@
1
- -- CreateEnum
2
- CREATE TYPE "EMatchState" AS ENUM ('UNREADY', 'READY', 'STARTED', 'FINISHED');
3
-
4
- -- CreateTable
5
- CREATE TABLE "UserStats" (
6
- "id" SERIAL NOT NULL,
7
- "accountId" INTEGER,
8
- "win" INTEGER NOT NULL DEFAULT 0,
9
- "loss" INTEGER NOT NULL DEFAULT 0,
10
- "satsBet" INTEGER NOT NULL DEFAULT 0,
11
- "satsWon" INTEGER NOT NULL DEFAULT 0,
12
- "satsLost" INTEGER NOT NULL DEFAULT 0,
13
-
14
- CONSTRAINT "UserStats_pkey" PRIMARY KEY ("id")
15
- );
16
-
17
- -- CreateTable
18
- CREATE TABLE "Match" (
19
- "id" SERIAL NOT NULL,
20
- "sessionId" TEXT NOT NULL,
21
- "state" "EMatchState" NOT NULL DEFAULT 'UNREADY',
22
- "ownerAccountId" INTEGER,
23
- "options" JSONB NOT NULL DEFAULT '{}',
24
- "results" JSONB NOT NULL DEFAULT '[{"buenas": 0,"malas": 0 },{ "buenas": 0,"malas": 0 }]',
25
-
26
- CONSTRAINT "Match_pkey" PRIMARY KEY ("id")
27
- );
28
-
29
- -- CreateTable
30
- CREATE TABLE "MatchBet" (
31
- "id" SERIAL NOT NULL,
32
- "matchId" INTEGER NOT NULL,
33
- "satsPerPlayer" INTEGER NOT NULL,
34
- "allPlayersPaid" BOOLEAN NOT NULL,
35
- "winnerAwarded" BOOLEAN NOT NULL,
36
-
37
- CONSTRAINT "MatchBet_pkey" PRIMARY KEY ("id")
38
- );
39
-
40
- -- CreateTable
41
- CREATE TABLE "MatchHand" (
42
- "id" SERIAL NOT NULL,
43
- "idx" INTEGER NOT NULL,
44
- "rounds" JSONB NOT NULL DEFAULT '[[]]',
45
- "results" JSONB NOT NULL DEFAULT '[0, 0]',
46
- "matchId" INTEGER NOT NULL,
47
- "trucoWinnerIdx" INTEGER NOT NULL,
48
- "envidoWinnerIdx" INTEGER,
49
- "florWinnerIdx" INTEGER,
50
-
51
- CONSTRAINT "MatchHand_pkey" PRIMARY KEY ("id")
52
- );
53
-
54
- -- CreateTable
55
- CREATE TABLE "MatchPlayer" (
56
- "id" SERIAL NOT NULL,
57
- "idx" INTEGER NOT NULL,
58
- "name" TEXT NOT NULL DEFAULT 'Satoshi',
59
- "accountId" INTEGER,
60
- "teamIdx" INTEGER NOT NULL,
61
- "satsPaid" INTEGER NOT NULL DEFAULT 0,
62
- "satsReceived" INTEGER NOT NULL DEFAULT 0,
63
- "payRequestId" INTEGER,
64
- "matchId" INTEGER NOT NULL,
65
-
66
- CONSTRAINT "MatchPlayer_pkey" PRIMARY KEY ("id")
67
- );
68
-
69
- -- CreateIndex
70
- CREATE UNIQUE INDEX "UserStats_accountId_key" ON "UserStats"("accountId");
71
-
72
- -- CreateIndex
73
- CREATE UNIQUE INDEX "MatchBet_matchId_key" ON "MatchBet"("matchId");
74
-
75
- -- AddForeignKey
76
- ALTER TABLE "MatchBet" ADD CONSTRAINT "MatchBet_matchId_fkey" FOREIGN KEY ("matchId") REFERENCES "Match"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
77
-
78
- -- AddForeignKey
79
- ALTER TABLE "MatchHand" ADD CONSTRAINT "MatchHand_matchId_fkey" FOREIGN KEY ("matchId") REFERENCES "Match"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
80
-
81
- -- AddForeignKey
82
- ALTER TABLE "MatchPlayer" ADD CONSTRAINT "MatchPlayer_matchId_fkey" FOREIGN KEY ("matchId") REFERENCES "Match"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
@@ -1,2 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE "MatchHand" ALTER COLUMN "trucoWinnerIdx" DROP NOT NULL;
@@ -1,3 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE "MatchPlayer" ADD COLUMN "session" TEXT NOT NULL DEFAULT '',
3
- ALTER COLUMN "idx" DROP NOT NULL;
@@ -1,2 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE "MatchPlayer" ALTER COLUMN "session" DROP DEFAULT;
@@ -1,2 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE "MatchPlayer" ADD COLUMN "matchSessionId" TEXT NOT NULL DEFAULT '';
@@ -1,8 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - You are about to drop the column `matchSessionId` on the `MatchPlayer` table. All the data in the column will be lost.
5
-
6
- */
7
- -- AlterTable
8
- ALTER TABLE "MatchPlayer" DROP COLUMN "matchSessionId";
@@ -1,3 +0,0 @@
1
- # Please do not edit this file manually
2
- # It should be added in your version-control system (i.e. Git)
3
- provider = "postgresql"
@@ -1,89 +0,0 @@
1
- // This is your Prisma schema file,
2
- // learn more about it in the docs: https://pris.ly/d/prisma-schema
3
-
4
- generator client {
5
- provider = "prisma-client-js"
6
- }
7
-
8
- generator distClient {
9
- provider = "prisma-client-js"
10
- output = "./client"
11
- }
12
-
13
- datasource db {
14
- provider = "postgresql"
15
- url = env("DATABASE_URL")
16
- }
17
-
18
- model UserStats {
19
- id Int @id @default(autoincrement())
20
- accountId Int? @unique
21
- win Int @default(0)
22
- loss Int @default(0)
23
- satsBet Int @default(0)
24
- satsWon Int @default(0)
25
- satsLost Int @default(0)
26
- }
27
-
28
- model Match {
29
- id Int @id @default(autoincrement())
30
- createdAt DateTime @default(now())
31
- updatedAt DateTime @updatedAt
32
- sessionId String
33
- state EMatchState @default(UNREADY)
34
- ownerAccountId Int?
35
- options Json @default("{}")
36
- results Json @default("[{\"buenas\": 0,\"malas\": 0 },{ \"buenas\": 0,\"malas\": 0 }]")
37
- winnerIdx Int?
38
- players MatchPlayer[]
39
- hands MatchHand[]
40
- bet MatchBet?
41
- }
42
-
43
- model MatchBet {
44
- id Int @id @default(autoincrement())
45
- createdAt DateTime @default(now())
46
- updatedAt DateTime @updatedAt
47
- match Match @relation(fields: [matchId], references: [id])
48
- matchId Int @unique
49
- satsPerPlayer Int
50
- allPlayersPaid Boolean
51
- winnerAwarded Boolean
52
- }
53
-
54
- model MatchHand {
55
- id Int @id @default(autoincrement())
56
- createdAt DateTime @default(now())
57
- updatedAt DateTime @updatedAt
58
- idx Int
59
- rounds Json @default("[[]]")
60
- results Json @default("[0, 0]")
61
- matchId Int
62
- match Match @relation(fields: [matchId], references: [id])
63
- trucoWinnerIdx Int?
64
- envidoWinnerIdx Int?
65
- florWinnerIdx Int?
66
- }
67
-
68
- model MatchPlayer {
69
- id Int @id @default(autoincrement())
70
- createdAt DateTime @default(now())
71
- updatedAt DateTime @updatedAt
72
- idx Int?
73
- name String @default("Satoshi")
74
- accountId Int?
75
- session String
76
- teamIdx Int
77
- satsPaid Int @default(0)
78
- satsReceived Int @default(0)
79
- payRequestId Int?
80
- matchId Int
81
- match Match @relation(fields: [matchId], references: [id])
82
- }
83
-
84
- enum EMatchState {
85
- UNREADY
86
- READY
87
- STARTED
88
- FINISHED
89
- }