2019-07-25 05:35:09 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS settings (
|
|
|
|
type VARCHAR PRIMARY KEY,
|
|
|
|
value BLOB
|
|
|
|
) WITHOUT ROWID;
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS accounts (
|
|
|
|
address VARCHAR PRIMARY KEY,
|
|
|
|
wallet BOOLEAN,
|
|
|
|
chat BOOLEAN,
|
|
|
|
type TEXT,
|
|
|
|
storage TEXT,
|
|
|
|
pubkey BLOB,
|
|
|
|
path TEXT,
|
|
|
|
name TEXT,
|
|
|
|
color TEXT
|
|
|
|
) WITHOUT ROWID;
|
|
|
|
|
|
|
|
CREATE UNIQUE INDEX unique_wallet_address ON accounts (wallet) WHERE (wallet);
|
|
|
|
CREATE UNIQUE INDEX unique_chat_address ON accounts (chat) WHERE (chat);
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS browsers (
|
|
|
|
id TEXT PRIMARY KEY,
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
timestamp USGIGNED BIGINT,
|
|
|
|
dapp BOOLEAN DEFAULT false,
|
|
|
|
historyIndex UNSIGNED INT
|
|
|
|
) WITHOUT ROWID;
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS browsers_history (
|
|
|
|
browser_id TEXT NOT NULL,
|
|
|
|
history TEXT,
|
|
|
|
FOREIGN KEY(browser_id) REFERENCES browsers(id) ON DELETE CASCADE
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS dapps (
|
|
|
|
name TEXT PRIMARY KEY
|
|
|
|
) WITHOUT ROWID;
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS permissions (
|
|
|
|
dapp_name TEXT NOT NULL,
|
|
|
|
permission TEXT NOT NULL,
|
|
|
|
FOREIGN KEY(dapp_name) REFERENCES dapps(name) ON DELETE CASCADE
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS transfers (
|
2019-08-08 08:15:07 +00:00
|
|
|
network_id UNSIGNED BIGINT NOT NULL,
|
|
|
|
hash VARCHAR NOT NULL,
|
2019-07-25 05:35:09 +00:00
|
|
|
address VARCHAR NOT NULL,
|
|
|
|
blk_hash VARCHAR NOT NULL,
|
|
|
|
tx BLOB,
|
|
|
|
sender VARCHAR NOT NULL,
|
|
|
|
receipt BLOB,
|
|
|
|
log BLOB,
|
|
|
|
type VARCHAR NOT NULL,
|
2019-08-08 08:15:07 +00:00
|
|
|
FOREIGN KEY(network_id,blk_hash) REFERENCES blocks(network_id,hash) ON DELETE CASCADE,
|
|
|
|
CONSTRAINT unique_transfer_per_address_per_network UNIQUE (hash,address,network_id)
|
2019-07-25 05:35:09 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS blocks (
|
2019-08-08 08:15:07 +00:00
|
|
|
network_id UNSIGNED BIGINT NOT NULL,
|
|
|
|
hash VARCHAR NOT NULL,
|
|
|
|
number BIGINT NOT NULL,
|
2019-07-25 05:35:09 +00:00
|
|
|
timestamp UNSIGNED BIGINT NOT NULL,
|
2019-08-08 08:15:07 +00:00
|
|
|
head BOOL DEFAULT FALSE,
|
|
|
|
CONSTRAINT unique_block_per_network UNIQUE (network_id,hash)
|
|
|
|
CONSTRAINT unique_block_number_per_network UNIQUE (network_id,number)
|
|
|
|
);
|
2019-07-25 05:35:09 +00:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS accounts_to_blocks (
|
2019-08-08 08:15:07 +00:00
|
|
|
network_id UNSIGNED BIGINT NOT NULL,
|
2019-07-25 05:35:09 +00:00
|
|
|
address VARCHAR NOT NULL,
|
|
|
|
blk_number BIGINT NOT NULL,
|
|
|
|
sync INT,
|
2019-08-08 08:15:07 +00:00
|
|
|
FOREIGN KEY(network_id,blk_number) REFERENCES blocks(network_id,number) ON DELETE CASCADE,
|
|
|
|
CONSTRAINT unique_mapping_for_account_to_block_per_network UNIQUE (address,blk_number,network_id)
|
2019-07-25 05:35:09 +00:00
|
|
|
);
|
2019-09-04 06:25:33 +00:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS mailservers (
|
|
|
|
id VARCHAR PRIMARY KEY,
|
|
|
|
name VARCHAR NOT NULL,
|
|
|
|
address VARCHAR NOT NULL,
|
|
|
|
password VARCHAR,
|
|
|
|
fleet VARCHAR NOT NULL
|
2019-09-04 18:23:17 +00:00
|
|
|
) WITHOUT ROWID;
|
2019-09-04 10:04:17 +00:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS mailserver_request_gaps (
|
2019-09-04 18:23:17 +00:00
|
|
|
gap_from UNSIGNED INTEGER NOT NULL,
|
|
|
|
gap_to UNSIGNED INTEGER NOT NULL,
|
|
|
|
id TEXT PRIMARY KEY,
|
|
|
|
chat_id TEXT NOT NULL
|
|
|
|
) WITHOUT ROWID;
|
2019-09-04 10:04:17 +00:00
|
|
|
|
|
|
|
CREATE INDEX mailserver_request_gaps_chat_id_idx ON mailserver_request_gaps (chat_id);
|
2019-09-04 18:23:17 +00:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS mailserver_topics (
|
|
|
|
topic VARCHAR PRIMARY KEY,
|
|
|
|
chat_ids VARCHAR,
|
Move to protobuf for Message type (#1706)
* Use a single Message type `v1/message.go` and `message.go` are the same now, and they embed `protobuf.ChatMessage`
* Use `SendChatMessage` for sending chat messages, this is basically the old `Send` but a bit more flexible so we can send different message types (stickers,commands), and not just text.
* Remove dedup from services/shhext. Because now we process in status-protocol, dedup makes less sense, as those messages are going to be processed anyway, so removing for now, we can re-evaluate if bringing it to status-go or not.
* Change the various retrieveX method to a single one:
`RetrieveAll` will be processing those messages that it can process (Currently only `Message`), and return the rest in `RawMessages` (still transit). The format for the response is:
`Chats`: -> The chats updated by receiving the message
`Messages`: -> The messages retrieved (already matched to a chat)
`Contacts`: -> The contacts updated by the messages
`RawMessages` -> Anything else that can't be parsed, eventually as we move everything to status-protocol-go this will go away.
2019-12-05 16:25:34 +00:00
|
|
|
last_request INTEGER DEFAULT 1,
|
|
|
|
discovery BOOLEAN DEFAULT FALSE,
|
|
|
|
negotiated BOOLEAN DEFAULT FALSE
|
2019-09-04 18:23:17 +00:00
|
|
|
) WITHOUT ROWID;
|
2019-09-06 13:02:31 +00:00
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS mailserver_chat_request_ranges (
|
|
|
|
chat_id VARCHAR PRIMARY KEY,
|
|
|
|
lowest_request_from INTEGER,
|
|
|
|
highest_request_to INTEGER
|
|
|
|
) WITHOUT ROWID;
|