diff --git a/migrations/20240731125851_minor_models_name_changes/migration.sql b/migrations/20240731125851_minor_models_name_changes/migration.sql new file mode 100644 index 0000000..0dbd05c --- /dev/null +++ b/migrations/20240731125851_minor_models_name_changes/migration.sql @@ -0,0 +1,18 @@ +-- CreateTable +CREATE TABLE "Game" ( + "game_id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "start_time" TEXT NOT NULL, + "end_time" TEXT NOT NULL, + "end_reason" TEXT NOT NULL +); + +-- CreateTable +CREATE TABLE "GameStats" ( + "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + "game_id" INTEGER NOT NULL, + "player_id" INTEGER NOT NULL, + "size" REAL NOT NULL, + "num_eaten" INTEGER NOT NULL, + "num_ate" INTEGER NOT NULL, + CONSTRAINT "GameStats_game_id_fkey" FOREIGN KEY ("game_id") REFERENCES "Game" ("game_id") ON DELETE RESTRICT ON UPDATE CASCADE +); diff --git a/schema.prisma b/schema.prisma index 8e01816..9ef9f4a 100644 --- a/schema.prisma +++ b/schema.prisma @@ -12,3 +12,21 @@ model User { password String username String @unique } + +model Game { + game_id Int @id @default(autoincrement()) + start_time String + end_time String + end_reason String + game_stats GameStats[] +} + +model GameStats { + id Int @id @default(autoincrement()) + game_id Int + player_id Int + size Float + num_eaten Int + num_ate Int + games Game @relation(fields: [game_id], references: [game_id]) +} \ No newline at end of file