From 0560330f680549c5a1a2cc02ace098ff198c2704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sat, 1 Jun 2024 14:15:47 +0200 Subject: [PATCH] Fix 4->5 migration --- scnserver/db/schema/primary_migration_4_5.ddl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scnserver/db/schema/primary_migration_4_5.ddl b/scnserver/db/schema/primary_migration_4_5.ddl index efa9540..9ae6abb 100644 --- a/scnserver/db/schema/primary_migration_4_5.ddl +++ b/scnserver/db/schema/primary_migration_4_5.ddl @@ -21,7 +21,15 @@ CREATE TABLE clients_new PRIMARY KEY (client_id) ) STRICT; -INSERT INTO clients_new SELECT * FROM clients; +UPDATE clients SET agent_model = 'UNKNOWN' WHERE agent_model IS NULL; +UPDATE clients SET agent_version = 'UNKNOWN' WHERE agent_version IS NULL; + +INSERT INTO clients_new +SELECT + client_id, user_id, type, fcm_token, name, timestamp_created, agent_model, agent_version +FROM clients; + + DROP TABLE clients; ALTER TABLE clients_new RENAME TO clients;