github.com/status-im/status-go@v1.1.0/protocol/pushnotificationclient/migrations/sql/1593601729_initial_schema.up.sql (about)

     1  CREATE TABLE IF NOT EXISTS push_notification_client_servers (
     2    public_key BLOB NOT NULL,
     3    registered BOOLEAN DEFAULT FALSE,
     4    registered_at INT NOT NULL DEFAULT 0,
     5    last_retried_at INT NOT NULL DEFAULT 0,
     6    retry_count INT NOT NULL DEFAULT 0,
     7    access_token TEXT,
     8    UNIQUE(public_key) ON CONFLICT REPLACE
     9  );
    10  
    11  CREATE TABLE IF NOT EXISTS push_notification_client_queries (
    12    public_key BLOB NOT NULL,
    13    queried_at INT NOT NULL,
    14    query_id BLOB NOT NULL,
    15    UNIQUE(public_key,query_id) ON CONFLICT REPLACE
    16  );
    17  
    18  CREATE TABLE IF NOT EXISTS push_notification_client_info (
    19    public_key BLOB NOT NULL,
    20    server_public_key BLOB NOT NULL,
    21    installation_id TEXT NOT NULL,
    22    access_token TEXT NOT NULL,
    23    retrieved_at INT NOT NULL,
    24    version INT NOT NULL,
    25    UNIQUE(public_key, installation_id, server_public_key) ON CONFLICT REPLACE
    26  );
    27  
    28  CREATE TABLE IF NOT EXISTS push_notification_client_tracked_messages (
    29    message_id BLOB NOT NULL,
    30    chat_id TEXT NOT NULL,
    31    tracked_at INT NOT NULL,
    32    UNIQUE(message_id) ON CONFLICT IGNORE
    33    );
    34  
    35  CREATE TABLE IF NOT EXISTS push_notification_client_sent_notifications (
    36    message_id BLOB NOT NULL,
    37    public_key BLOB NOT NULL,
    38    hashed_public_key BLOB NOT NULL,
    39    installation_id TEXT NOT NULL,
    40    last_tried_at INT NOT NULL,
    41    retry_count INT NOT NULL DEFAULT 0,
    42    success BOOLEAN NOT NULL DEFAULT FALSE,
    43    error INT NOT NULL DEFAULT 0,
    44    UNIQUE(message_id, public_key, installation_id) ON CONFLICT REPLACE
    45    );
    46  
    47  CREATE TABLE IF NOT EXISTS push_notification_client_registrations (
    48      registration BLOB NOT NULL,
    49      contact_ids BLOB,
    50      synthetic_id INT NOT NULL DEFAULT 0,
    51      UNIQUE(synthetic_id) ON CONFLICT REPLACE
    52  );
    53  
    54  CREATE INDEX idx_push_notification_client_info_public_key ON push_notification_client_info(public_key, installation_id);