]> git.seodisparate.com - EN605.607.81.SP22_ASDM_Project/commitdiff
Update backend_database_specification.md
authorStephen Seo <seo.disparate@gmail.com>
Mon, 21 Mar 2022 04:25:32 +0000 (13:25 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Wed, 23 Mar 2022 07:12:36 +0000 (16:12 +0900)
backend_database_specification.md

index d5069bb8ddd5a19a2cd17f0455678b214219d9d2..a7c02fb6699358a7d35e5f49b190ab16e873f3df 100644 (file)
@@ -24,13 +24,13 @@ CREATE TABLE players (id INTEGER PRIMARY KEY NOT NULL,
 // "3" for magenta won, "4" for draw.
 
 CREATE TABLE games (id INTEGER PRIMARY KEY NOT NULL,
-                    cyan_player INTEGER UNIQUE NOT NULL,
-                    magenta_player INTEGER UNIQUE NOT NULL,
+                    cyan_player INTEGER UNIQUE,
+                    magenta_player INTEGER UNIQUE,
                     date_changed TEXT NOT NULL,
                     board TEXT NOT NULL,
                     status INTEGER NOT NULL,
-                    FOREIGN KEY(cyan_player) REFERENCES players (id),
-                    FOREIGN KEY(magenta_player) REFERENCES players (id));
+                    FOREIGN KEY(cyan_player) REFERENCES players (id) ON DELETE SET NULL,
+                    FOREIGN KEY(magenta_player) REFERENCES players (id) ON DELETE SET NULL);
 ```
 
 "date" entries are used for garbage collection of the database. A predefined