Commit Graph

3 Commits

Author SHA1 Message Date
52df45b2e9 GORM for the database for Postgres support
* For the Direct Message History database, use gorm.io as ORM so that Postgres
  can be used instead of SQLite for bigger chat room instances.
* In settings.toml: the new DatabaseType field defaults to 'sqlite3' but can be
  set to 'postgres' and use the credentials in the new PostgresDatabase field.
* The DirectMessage table schema is also updated to deprecate the Timestamp int
  field in favor of a proper CreatedAt datetime field. Existing SQLite instances
  will upgrade their table in the background, converting Timestamp to CreatedAt
  and blanking out the legacy Timestamp column.
* Fix some DB queries so when paginating your DMs history username list, sorting
  it by timestamp now works reliably.
* For existing SQLite instances that want to switch to Postgres, use the
  scripts/sqlite2psql.py script to transfer your database over.
2025-07-06 11:56:20 -07:00
23a73620b9 Switch to mattn/go-sqlite3
Instead of the pure Go implementation of SQLite, swap in the cgo library
from mattn/go-sqlite3. On local testing this cuts the SQL query times in
half for the History modal (from 400ms per page to 150ms) and may
improve performance in production.
2025-03-17 17:58:03 -07:00
f0dd1d952c Direct Message History
* Add support for storing DM history between users in a SQLite3 database.
* Opt-in by editing your settings.toml to set DirectMessageHistory/Enabled=true
* Retention days (default 90) will flush old DMs on app startup.
* On the front-end, DM history is checked when a DM thread is opened.
2024-03-29 17:48:01 -07:00