Fossil SCM
Ensure that the TEMP TRIGGERs that keep the chat FTS index up-to-date exist before inserting new entries into the chat table itself.
Commit
614b3f755984bdaa79549ac25282a0934b79e56ebbf5705c30114655b26c6db5
Parent
d5504f9deb324a8…
2 files changed
+1
+1
-1
+1
| --- src/alerts.c | ||
| +++ src/alerts.c | ||
| @@ -159,10 +159,11 @@ | ||
| 159 | 159 | if( db_table_exists("temp","deferred_chat_events") |
| 160 | 160 | && db_table_exists("repository","chat") |
| 161 | 161 | ){ |
| 162 | 162 | const char *zChatUser = db_get("chat-timeline-user", 0); |
| 163 | 163 | if( zChatUser && zChatUser[0] ){ |
| 164 | + chat_create_tables(); /* Make sure TEMP TRIGGERs for FTS exist */ | |
| 164 | 165 | db_multi_exec( |
| 165 | 166 | "INSERT INTO chat(mtime,lmtime,xfrom,xmsg)" |
| 166 | 167 | " SELECT julianday(), " |
| 167 | 168 | " strftime('%%Y-%%m-%%dT%%H:%%M:%%S','now','localtime')," |
| 168 | 169 | " %Q," |
| 169 | 170 |
| --- src/alerts.c | |
| +++ src/alerts.c | |
| @@ -159,10 +159,11 @@ | |
| 159 | if( db_table_exists("temp","deferred_chat_events") |
| 160 | && db_table_exists("repository","chat") |
| 161 | ){ |
| 162 | const char *zChatUser = db_get("chat-timeline-user", 0); |
| 163 | if( zChatUser && zChatUser[0] ){ |
| 164 | db_multi_exec( |
| 165 | "INSERT INTO chat(mtime,lmtime,xfrom,xmsg)" |
| 166 | " SELECT julianday(), " |
| 167 | " strftime('%%Y-%%m-%%dT%%H:%%M:%%S','now','localtime')," |
| 168 | " %Q," |
| 169 |
| --- src/alerts.c | |
| +++ src/alerts.c | |
| @@ -159,10 +159,11 @@ | |
| 159 | if( db_table_exists("temp","deferred_chat_events") |
| 160 | && db_table_exists("repository","chat") |
| 161 | ){ |
| 162 | const char *zChatUser = db_get("chat-timeline-user", 0); |
| 163 | if( zChatUser && zChatUser[0] ){ |
| 164 | chat_create_tables(); /* Make sure TEMP TRIGGERs for FTS exist */ |
| 165 | db_multi_exec( |
| 166 | "INSERT INTO chat(mtime,lmtime,xfrom,xmsg)" |
| 167 | " SELECT julianday(), " |
| 168 | " strftime('%%Y-%%m-%%dT%%H:%%M:%%S','now','localtime')," |
| 169 | " %Q," |
| 170 |
+1
-1
| --- src/chat.c | ||
| +++ src/chat.c | ||
| @@ -323,11 +323,11 @@ | ||
| 323 | 323 | /* |
| 324 | 324 | ** Make sure the repository data tables used by chat exist. Create |
| 325 | 325 | ** them if they do not. Set up TEMP triggers (if needed) to update the |
| 326 | 326 | ** chatfts1 table as the chat table is updated. |
| 327 | 327 | */ |
| 328 | -static void chat_create_tables(void){ | |
| 328 | +void chat_create_tables(void){ | |
| 329 | 329 | if( !db_table_exists("repository","chat") ){ |
| 330 | 330 | db_multi_exec(zChatSchema1/*works-like:""*/); |
| 331 | 331 | }else if( !db_table_has_column("repository","chat","lmtime") ){ |
| 332 | 332 | if( !db_table_has_column("repository","chat","mdel") ){ |
| 333 | 333 | db_multi_exec("ALTER TABLE chat ADD COLUMN mdel INT"); |
| 334 | 334 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -323,11 +323,11 @@ | |
| 323 | /* |
| 324 | ** Make sure the repository data tables used by chat exist. Create |
| 325 | ** them if they do not. Set up TEMP triggers (if needed) to update the |
| 326 | ** chatfts1 table as the chat table is updated. |
| 327 | */ |
| 328 | static void chat_create_tables(void){ |
| 329 | if( !db_table_exists("repository","chat") ){ |
| 330 | db_multi_exec(zChatSchema1/*works-like:""*/); |
| 331 | }else if( !db_table_has_column("repository","chat","lmtime") ){ |
| 332 | if( !db_table_has_column("repository","chat","mdel") ){ |
| 333 | db_multi_exec("ALTER TABLE chat ADD COLUMN mdel INT"); |
| 334 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -323,11 +323,11 @@ | |
| 323 | /* |
| 324 | ** Make sure the repository data tables used by chat exist. Create |
| 325 | ** them if they do not. Set up TEMP triggers (if needed) to update the |
| 326 | ** chatfts1 table as the chat table is updated. |
| 327 | */ |
| 328 | void chat_create_tables(void){ |
| 329 | if( !db_table_exists("repository","chat") ){ |
| 330 | db_multi_exec(zChatSchema1/*works-like:""*/); |
| 331 | }else if( !db_table_has_column("repository","chat","lmtime") ){ |
| 332 | if( !db_table_has_column("repository","chat","mdel") ){ |
| 333 | db_multi_exec("ALTER TABLE chat ADD COLUMN mdel INT"); |
| 334 |