deltachat::sql::migrations

Constant TABLES

source
const TABLES: &str = "CREATE TABLE config (\n  id INTEGER PRIMARY KEY,\n  keyname TEXT,\n  value TEXT\n);\nCREATE INDEX config_index1 ON config (keyname);\nCREATE TABLE contacts (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    name TEXT DEFAULT \'\',\n    addr TEXT DEFAULT \'\' COLLATE NOCASE,\n    origin INTEGER DEFAULT 0,\n    blocked INTEGER DEFAULT 0,\n    last_seen INTEGER DEFAULT 0,\n    param TEXT DEFAULT \'\',\n    authname TEXT DEFAULT \'\',\n    selfavatar_sent INTEGER DEFAULT 0\n);\nCREATE INDEX contacts_index1 ON contacts (name COLLATE NOCASE);\nCREATE INDEX contacts_index2 ON contacts (addr COLLATE NOCASE);\nINSERT INTO contacts (id,name,origin) VALUES\n(1,\'self\',262144), (2,\'info\',262144), (3,\'rsvd\',262144),\n(4,\'rsvd\',262144), (5,\'device\',262144), (6,\'rsvd\',262144),\n(7,\'rsvd\',262144), (8,\'rsvd\',262144), (9,\'rsvd\',262144);\n\nCREATE TABLE chats (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    type INTEGER DEFAULT 0,\n    name TEXT DEFAULT \'\',\n    draft_timestamp INTEGER DEFAULT 0,\n    draft_txt TEXT DEFAULT \'\',\n    blocked INTEGER DEFAULT 0,\n    grpid TEXT DEFAULT \'\',\n    param TEXT DEFAULT \'\',\n    archived INTEGER DEFAULT 0,\n    gossiped_timestamp INTEGER DEFAULT 0,\n    locations_send_begin INTEGER DEFAULT 0,\n    locations_send_until INTEGER DEFAULT 0,\n    locations_last_sent INTEGER DEFAULT 0,\n    created_timestamp INTEGER DEFAULT 0,\n    muted_until INTEGER DEFAULT 0,\n    ephemeral_timer INTEGER\n);\nCREATE INDEX chats_index1 ON chats (grpid);\nCREATE INDEX chats_index2 ON chats (archived);\nCREATE INDEX chats_index3 ON chats (locations_send_until);\nINSERT INTO chats (id,type,name) VALUES\n(1,120,\'deaddrop\'), (2,120,\'rsvd\'), (3,120,\'trash\'),\n(4,120,\'msgs_in_creation\'), (5,120,\'starred\'), (6,120,\'archivedlink\'),\n(7,100,\'rsvd\'), (8,100,\'rsvd\'), (9,100,\'rsvd\');\n\nCREATE TABLE chats_contacts (chat_id INTEGER, contact_id INTEGER);\nCREATE INDEX chats_contacts_index1 ON chats_contacts (chat_id);\nCREATE INDEX chats_contacts_index2 ON chats_contacts (contact_id);\n\nCREATE TABLE msgs (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    rfc724_mid TEXT DEFAULT \'\',\n    server_folder TEXT DEFAULT \'\',\n    server_uid INTEGER DEFAULT 0,\n    chat_id INTEGER DEFAULT 0,\n    from_id INTEGER DEFAULT 0,\n    to_id INTEGER DEFAULT 0,\n    timestamp INTEGER DEFAULT 0,\n    type INTEGER DEFAULT 0,\n    state INTEGER DEFAULT 0,\n    msgrmsg INTEGER DEFAULT 1,\n    bytes INTEGER DEFAULT 0,\n    txt TEXT DEFAULT \'\',\n    txt_raw TEXT DEFAULT \'\',\n    param TEXT DEFAULT \'\',\n    starred INTEGER DEFAULT 0,\n    timestamp_sent INTEGER DEFAULT 0,\n    timestamp_rcvd INTEGER DEFAULT 0,\n    hidden INTEGER DEFAULT 0,\n    -- mime_headers column actually contains BLOBs, i.e. it may\n    -- contain non-UTF8 MIME messages.  TEXT was a bad choice, but\n    -- thanks to SQLite 3 being dynamically typed, there is no need to\n    -- change column type.\n    mime_headers TEXT,\n    mime_in_reply_to TEXT,\n    mime_references TEXT,\n    move_state INTEGER DEFAULT 1,\n    location_id INTEGER DEFAULT 0,\n    error TEXT DEFAULT \'\',\n\n-- Timer value in seconds. For incoming messages this\n-- timer starts when message is read, so we want to have\n-- the value stored here until the timer starts.\n    ephemeral_timer INTEGER DEFAULT 0,\n\n-- Timestamp indicating when the message should be\n-- deleted. It is convenient to store it here because UI\n-- needs this value to display how much time is left until\n-- the message is deleted.\n    ephemeral_timestamp INTEGER DEFAULT 0\n);\n\nCREATE INDEX msgs_index1 ON msgs (rfc724_mid);\nCREATE INDEX msgs_index2 ON msgs (chat_id);\nCREATE INDEX msgs_index3 ON msgs (timestamp);\nCREATE INDEX msgs_index4 ON msgs (state);\nCREATE INDEX msgs_index5 ON msgs (starred);\nCREATE INDEX msgs_index6 ON msgs (location_id);\nCREATE INDEX msgs_index7 ON msgs (state, hidden, chat_id);\nINSERT INTO msgs (id,msgrmsg,txt) VALUES\n(1,0,\'marker1\'), (2,0,\'rsvd\'), (3,0,\'rsvd\'),\n(4,0,\'rsvd\'), (5,0,\'rsvd\'), (6,0,\'rsvd\'), (7,0,\'rsvd\'),\n(8,0,\'rsvd\'), (9,0,\'daymarker\');\n\nCREATE TABLE jobs (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    added_timestamp INTEGER,\n    desired_timestamp INTEGER DEFAULT 0,\n    action INTEGER,\n    foreign_id INTEGER,\n    param TEXT DEFAULT \'\',\n    thread INTEGER DEFAULT 0,\n    tries INTEGER DEFAULT 0\n);\nCREATE INDEX jobs_index1 ON jobs (desired_timestamp);\n\nCREATE TABLE leftgrps (\n    id INTEGER PRIMARY KEY,\n    grpid TEXT DEFAULT \'\'\n);\nCREATE INDEX leftgrps_index1 ON leftgrps (grpid);\n\nCREATE TABLE keypairs (\n    id INTEGER PRIMARY KEY,\n    addr TEXT DEFAULT \'\' COLLATE NOCASE,\n    is_default INTEGER DEFAULT 0,\n    private_key,\n    public_key,\n    created INTEGER DEFAULT 0\n);\n\nCREATE TABLE acpeerstates (\n    id INTEGER PRIMARY KEY,\n    addr TEXT DEFAULT \'\' COLLATE NOCASE,\n    last_seen INTEGER DEFAULT 0,\n    last_seen_autocrypt INTEGER DEFAULT 0,\n    public_key,\n    prefer_encrypted INTEGER DEFAULT 0,\n    gossip_timestamp INTEGER DEFAULT 0,\n    gossip_key,\n    public_key_fingerprint TEXT DEFAULT \'\',\n    gossip_key_fingerprint TEXT DEFAULT \'\',\n    verified_key,\n    verified_key_fingerprint TEXT DEFAULT \'\'\n);\nCREATE INDEX acpeerstates_index1 ON acpeerstates (addr);\nCREATE INDEX acpeerstates_index3 ON acpeerstates (public_key_fingerprint);\nCREATE INDEX acpeerstates_index4 ON acpeerstates (gossip_key_fingerprint);\nCREATE INDEX acpeerstates_index5 ON acpeerstates (verified_key_fingerprint);\n\nCREATE TABLE msgs_mdns (\n    msg_id INTEGER,\n    contact_id INTEGER,\n    timestamp_sent INTEGER DEFAULT 0\n);\nCREATE INDEX msgs_mdns_index1 ON msgs_mdns (msg_id);\n\nCREATE TABLE tokens (\n    id INTEGER PRIMARY KEY,\n    namespc INTEGER DEFAULT 0,\n    foreign_id INTEGER DEFAULT 0,\n    token TEXT DEFAULT \'\',\n    timestamp INTEGER DEFAULT 0\n);\n\n-- The currently running securejoin protocols, joiner-side.\n-- CREATE TABLE bobstate (\n--     id INTEGER PRIMARY KEY AUTOINCREMENT,\n--     invite TEXT NOT NULL,\n--     next_step INTEGER NOT NULL,\n--     chat_id INTEGER NOT NULL\n-- );\n\nCREATE TABLE locations (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    latitude REAL DEFAULT 0.0,\n    longitude REAL DEFAULT 0.0,\n    accuracy REAL DEFAULT 0.0,\n    timestamp INTEGER DEFAULT 0,\n    chat_id INTEGER DEFAULT 0,\n    from_id INTEGER DEFAULT 0,\n    independent INTEGER DEFAULT 0\n);\nCREATE INDEX locations_index1 ON locations (from_id);\nCREATE INDEX locations_index2 ON locations (timestamp);\n\nCREATE TABLE devmsglabels (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    label TEXT,\n    msg_id INTEGER DEFAULT 0\n);\nCREATE INDEX devmsglabels_index1 ON devmsglabels (label);\n";