From 9a455686c7e71e71fa84514760e9fb3202da1ca7 Mon Sep 17 00:00:00 2001
From: Tor Andersson <tor@ccxvii.net>
Date: Wed, 5 Jul 2023 15:15:21 +0200
Subject: Add "xtime" column for games to record finish date when state is
 missing.

---
 schema.sql | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'schema.sql')

diff --git a/schema.sql b/schema.sql
index 144ba7d..8e5ff4d 100644
--- a/schema.sql
+++ b/schema.sql
@@ -279,7 +279,8 @@ create table if not exists games (
 	is_random boolean default 0,
 	notice text,
 	status integer default 0,
-	result text
+	result text,
+	xtime datetime
 );
 
 create index if not exists games_title_idx on games(title_id);
@@ -356,7 +357,7 @@ create view game_view as
 		games.*,
 		titles.title_name,
 		owner.name as owner_name,
-		game_state.mtime,
+		coalesce(game_state.mtime, xtime) as mtime,
 		game_state.active
 	from
 		games
-- 
cgit v1.2.3

