whatsxmpp/fixup_2.sql
eta d664cb800c Introduce user & global archiving controls; add unregister function
- WARNING to operators: You MUST run fixup_2.sql in order to use this and newer
  versions of the bridge.
- Archiving and full chat history fetches are now a configuration setting (and
  default to off).
- Users now have to enable archiving manually by talking to the admin user, and
  are warned about the potential privacy implications.
- Users can now completely remove themselves from the bridge, deleting all data.
- Bridge administrators can now be specified by adding an entry to the
  'administrators' SQL table with your JID. These can force-unregister specific
  users.
2020-09-30 14:01:52 +01:00

22 lines
735 B
PL/PgSQL

BEGIN;
ALTER TABLE configuration ADD COLUMN allow_archiving BOOL NOT NULL DEFAULT false;
ALTER TABLE configuration ADD COLUMN allow_history_fetches BOOL NOT NULL DEFAULT false;
ALTER TABLE users ADD COLUMN enable_archiving BOOL NOT NULL DEFAULT false;
CREATE TABLE administrators (
id INTEGER PRIMARY KEY,
jid VARCHAR UNIQUE NOT NULL
);
CREATE TABLE user_chat_history (
id INTEGER PRIMARY KEY,
user_id INT NOT NULL REFERENCES users,
chat_id INT NOT NULL REFERENCES user_chats,
user_from VARCHAR NOT NULL,
ts_unix INT NOT NULL,
xmpp_id VARCHAR NOT NULL,
orig_id VARCHAR,
body VARCHAR NOT NULL,
oob_url VARCHAR
);
CREATE UNIQUE INDEX user_chat_history_unique ON user_chat_history (user_id, chat_id, xmpp_id);
COMMIT;