basic shape

This commit is contained in:
2025-08-06 23:29:55 -04:00
parent 3891e8b85b
commit 839d596b55
46 changed files with 220 additions and 5507 deletions

View File

@@ -0,0 +1,19 @@
-- CreateTable
CREATE TABLE "Game" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
"name" TEXT NOT NULL,
"rules" TEXT
);
-- CreateTable
CREATE TABLE "Instance" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"gameId" INTEGER NOT NULL,
"gameState" JSONB NOT NULL,
CONSTRAINT "Instance_gameId_fkey" FOREIGN KEY ("gameId") REFERENCES "Game" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "Game_name_key" ON "Game"("name");

View File

@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "sqlite"

24
db/schema.prisma Normal file
View File

@@ -0,0 +1,24 @@
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = "file:./db/dev.db"
}
model Game {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String @unique
rules String?
instances Instance[]
}
model Instance {
id Int @id @default(autoincrement())
gameId Int
game Game @relation(fields: [gameId], references: [id])
gameState Json
}