2020-07-10 13:26:06 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS push_notification_client_servers (
|
|
|
|
public_key BLOB NOT NULL,
|
|
|
|
registered BOOLEAN DEFAULT FALSE,
|
|
|
|
registered_at INT NOT NULL DEFAULT 0,
|
2020-07-15 10:29:16 +00:00
|
|
|
last_retried_at INT NOT NULL DEFAULT 0,
|
|
|
|
retry_count INT NOT NULL DEFAULT 0,
|
2020-07-10 13:26:06 +00:00
|
|
|
access_token TEXT,
|
|
|
|
UNIQUE(public_key) ON CONFLICT REPLACE
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS push_notification_client_queries (
|
|
|
|
public_key BLOB NOT NULL,
|
|
|
|
queried_at INT NOT NULL,
|
|
|
|
query_id BLOB NOT NULL,
|
|
|
|
UNIQUE(public_key,query_id) ON CONFLICT REPLACE
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS push_notification_client_info (
|
|
|
|
public_key BLOB NOT NULL,
|
|
|
|
server_public_key BLOB NOT NULL,
|
|
|
|
installation_id TEXT NOT NULL,
|
|
|
|
access_token TEXT NOT NULL,
|
|
|
|
retrieved_at INT NOT NULL,
|
2020-07-17 11:41:49 +00:00
|
|
|
version INT NOT NULL,
|
2020-07-10 13:26:06 +00:00
|
|
|
UNIQUE(public_key, installation_id, server_public_key) ON CONFLICT REPLACE
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS push_notification_client_tracked_messages (
|
|
|
|
message_id BLOB NOT NULL,
|
|
|
|
chat_id TEXT NOT NULL,
|
|
|
|
tracked_at INT NOT NULL,
|
|
|
|
UNIQUE(message_id) ON CONFLICT IGNORE
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS push_notification_client_sent_notifications (
|
|
|
|
message_id BLOB NOT NULL,
|
|
|
|
public_key BLOB NOT NULL,
|
2020-07-20 10:01:42 +00:00
|
|
|
hashed_public_key BLOB NOT NULL,
|
2020-07-10 13:26:06 +00:00
|
|
|
installation_id TEXT NOT NULL,
|
2020-07-20 12:46:15 +00:00
|
|
|
last_tried_at INT NOT NULL,
|
|
|
|
retry_count INT NOT NULL DEFAULT 0,
|
2020-07-20 10:01:42 +00:00
|
|
|
success BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
error INT NOT NULL DEFAULT 0,
|
2020-07-20 14:52:55 +00:00
|
|
|
UNIQUE(message_id, public_key, installation_id) ON CONFLICT REPLACE
|
2020-07-10 13:26:06 +00:00
|
|
|
);
|
|
|
|
|
2020-07-15 07:23:31 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS push_notification_client_registrations (
|
|
|
|
registration BLOB NOT NULL,
|
2020-07-15 08:22:43 +00:00
|
|
|
contact_ids BLOB,
|
2020-07-15 07:23:31 +00:00
|
|
|
synthetic_id INT NOT NULL DEFAULT 0,
|
|
|
|
UNIQUE(synthetic_id) ON CONFLICT REPLACE
|
|
|
|
);
|
|
|
|
|
2020-07-10 13:26:06 +00:00
|
|
|
CREATE INDEX idx_push_notification_client_info_public_key ON push_notification_client_info(public_key, installation_id);
|