trucoshi 3.0.0 → 4.0.3

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,28 +0,0 @@
1
- /*
2
- Warnings:
3
-
4
- - Added the required column `updatedAt` to the `Match` table without a default value. This is not possible if the table is not empty.
5
- - Added the required column `updatedAt` to the `MatchBet` table without a default value. This is not possible if the table is not empty.
6
- - Added the required column `secret` to the `MatchHand` table without a default value. This is not possible if the table is not empty.
7
- - Added the required column `updatedAt` to the `MatchHand` table without a default value. This is not possible if the table is not empty.
8
- - Added the required column `updatedAt` to the `MatchPlayer` table without a default value. This is not possible if the table is not empty.
9
-
10
- */
11
- -- AlterTable
12
- ALTER TABLE "Match" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
13
- ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL,
14
- ADD COLUMN "winnerIdx" INTEGER;
15
-
16
- -- AlterTable
17
- ALTER TABLE "MatchBet" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
18
- ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL;
19
-
20
- -- AlterTable
21
- ALTER TABLE "MatchHand" ADD COLUMN "clientSecrets" TEXT[],
22
- ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
23
- ADD COLUMN "secret" TEXT NOT NULL,
24
- ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL;
25
-
26
- -- AlterTable
27
- ALTER TABLE "MatchPlayer" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
28
- ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL;
@@ -1,3 +0,0 @@
1
- -- AlterTable
2
- ALTER TABLE "MatchHand" ALTER COLUMN "clientSecrets" SET DEFAULT ARRAY[]::TEXT[],
3
- ALTER COLUMN "secret" SET DEFAULT '';
@@ -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,91 +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
- secret String @default("")
60
- clientSecrets String[] @default([])
61
- rounds Json @default("[[]]")
62
- results Json @default("[0, 0]")
63
- matchId Int
64
- match Match @relation(fields: [matchId], references: [id])
65
- trucoWinnerIdx Int?
66
- envidoWinnerIdx Int?
67
- florWinnerIdx Int?
68
- }
69
-
70
- model MatchPlayer {
71
- id Int @id @default(autoincrement())
72
- createdAt DateTime @default(now())
73
- updatedAt DateTime @updatedAt
74
- idx Int?
75
- name String @default("Satoshi")
76
- accountId Int?
77
- session String
78
- teamIdx Int
79
- satsPaid Int @default(0)
80
- satsReceived Int @default(0)
81
- payRequestId Int?
82
- matchId Int
83
- match Match @relation(fields: [matchId], references: [id])
84
- }
85
-
86
- enum EMatchState {
87
- UNREADY
88
- READY
89
- STARTED
90
- FINISHED
91
- }