From 52293b17435231771f475f91b504e9c997867762 Mon Sep 17 00:00:00 2001 From: Jeff Zohrab Date: Sat, 18 Jan 2025 15:29:12 -0600 Subject: [PATCH] Data fix for subsequent migration script. --- .../20241220_fix_for_wordsread_table_load.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lute/db/schema/migrations/20241220_fix_for_wordsread_table_load.sql diff --git a/lute/db/schema/migrations/20241220_fix_for_wordsread_table_load.sql b/lute/db/schema/migrations/20241220_fix_for_wordsread_table_load.sql new file mode 100644 index 000000000..2ba5ad6b1 --- /dev/null +++ b/lute/db/schema/migrations/20241220_fix_for_wordsread_table_load.sql @@ -0,0 +1,11 @@ +-- Manual fix for 20241221_add_wordsread_table.sql, which will be run after this script! +-- +-- Hacky fix: a user had a problem during startup and running of the above script +-- at query +-- insert into wordsread (WrLgID, WrTxID, WrReadDate, WrWordCount) +-- select bklgid, txid, txreaddate, txwordcount from texts inner join books on bkid=txbkid where txreaddate is not null; +-- b/c somehow a text had txreaddate not null, but txwordcount = null. +-- +-- SHOULD NEVER HAVE HAPPENED but what are you going to do. + +update texts set txwordcount = 0 where txwordcount is null and txreaddate is not null;