From 495a11b87f6bf928605616c52a1b3af2048b57cc Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Fri, 18 Mar 2022 17:03:07 +0900 Subject: [PATCH] Update backend database specification --- backend_database_specification.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend_database_specification.md b/backend_database_specification.md index 9c7d75d..d5069bb 100644 --- a/backend_database_specification.md +++ b/backend_database_specification.md @@ -12,8 +12,8 @@ PRAGMA foreign_keys = ON; // fields should be self explanatory for the players table CREATE TABLE players (id INTEGER PRIMARY KEY NOT NULL, date_added TEXT NOT NULL, - game_id INTEGER UNIQUE, - FOREIGN KEY(game_id) REFERENCES games(id)); + game_id INTEGER, + FOREIGN KEY(game_id) REFERENCES games(id) ON DELETE CASCADE); // "cyan_player" and "magenta_player" should correspond to an existing entry in // table "players". @@ -23,7 +23,7 @@ CREATE TABLE players (id INTEGER PRIMARY KEY NOT NULL, // "status" is "0" for cyan's turn, "1" for magenta's turn, "2" for cyan won, // "3" for magenta won, "4" for draw. -CREATE TABLE games (id INTEGER PRIMARY KEY ASC AUTOINCREMENT NOT NULL, +CREATE TABLE games (id INTEGER PRIMARY KEY NOT NULL, cyan_player INTEGER UNIQUE NOT NULL, magenta_player INTEGER UNIQUE NOT NULL, date_changed TEXT NOT NULL,