Fossil

Check-in [cdbdaee642]
Login

Check-in [cdbdaee642]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Ensure that that the chatfts1 table and triggers are created in the repository db, rather than the main db, else it breaks when running via the ui command (where the checkout is the main db).
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | fts5-chat-search
Files: files | file ages | folders
SHA3-256: cdbdaee6421987ba07de435431d2c738007c08214f21d8e0227cd1609bd8d56b
User & Date: stephan 2024-06-30 10:47:20.121
Context
2024-06-30
11:25
Teach stylesheet_url_var() to use the style_set_current_page() value, if set, instead of g.zPage, so that style_set_current_page() can be used to force closely-related pages (namely /chat and /chat-search) to use the same style.CurrentPageName.css, to avoid having to duplicate style sheets. Remove the now-unnecessary style.chat-search.css and port its handful of additions into style.chat.css. Adjust the /chat-search 'mark' CSS class to behave nicely in dark-mode themes. ... (check-in: 3bf2275393 user: stephan tags: fts5-chat-search)
10:47
Ensure that that the chatfts1 table and triggers are created in the repository db, rather than the main db, else it breaks when running via the ui command (where the checkout is the main db). ... (check-in: cdbdaee642 user: stephan tags: fts5-chat-search)
09:59
Extend test-chat-formatter to be able to render both wiki and markdown. ... (check-in: 09ee2c8e71 user: stephan tags: fts5-chat-search)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/chat.c.
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
      db_multi_exec("ALTER TABLE chat ADD COLUMN mdel INT");
    }
    db_multi_exec("ALTER TABLE chat ADD COLUMN lmtime TEXT");
  }

  if( !db_table_exists("repository", "chatfts1") ){
    db_multi_exec(
      "CREATE VIRTUAL TABLE chatfts1 USING fts5("
      "    xmsg, content=chat, content_rowid=msgid, tokenize=porter"
      ");"
      "CREATE TRIGGER chat_ai AFTER INSERT ON chat BEGIN "
      "  INSERT INTO chatfts1(rowid, xmsg) VALUES(new.msgid, new.xmsg);"
      "END;"
      "CREATE TRIGGER chat_ad AFTER DELETE ON chat BEGIN "
      "  INSERT INTO chatfts1(chatfts1, rowid, xmsg) "
      "    VALUES('delete', old.msgid, old.xmsg);"
      "END;"
      "INSERT INTO chatfts1(chatfts1) VALUES('rebuild');"
    );
  }
}

/*
** Delete old content from the chat table.
*/







|


|


|



|







340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
      db_multi_exec("ALTER TABLE chat ADD COLUMN mdel INT");
    }
    db_multi_exec("ALTER TABLE chat ADD COLUMN lmtime TEXT");
  }

  if( !db_table_exists("repository", "chatfts1") ){
    db_multi_exec(
      "CREATE VIRTUAL TABLE repository.chatfts1 USING fts5("
      "    xmsg, content=chat, content_rowid=msgid, tokenize=porter"
      ");"
      "CREATE TRIGGER repository.chat_ai AFTER INSERT ON chat BEGIN "
      "  INSERT INTO chatfts1(rowid, xmsg) VALUES(new.msgid, new.xmsg);"
      "END;"
      "CREATE TRIGGER repository.chat_ad AFTER DELETE ON chat BEGIN "
      "  INSERT INTO chatfts1(chatfts1, rowid, xmsg) "
      "    VALUES('delete', old.msgid, old.xmsg);"
      "END;"
      "INSERT INTO repository.chatfts1(chatfts1) VALUES('rebuild');"
    );
  }
}

/*
** Delete old content from the chat table.
*/