github.com/status-im/status-go@v1.1.0/protocol/migrations/sqlite/1699041816_profile_showcase_contacts.up.sql (about)

     1  DROP TABLE profile_showcase_preferences;
     2  DROP TABLE profile_showcase_contacts;
     3  
     4  -- Four tables for storing own profile showcase preferences
     5  CREATE TABLE profile_showcase_communities_preferences (
     6      community_id TEXT PRIMARY KEY ON CONFLICT REPLACE,
     7      visibility INT NOT NULL DEFAULT 0,
     8      sort_order INT DEFAULT 0
     9  );
    10  
    11  CREATE TABLE profile_showcase_accounts_preferences (
    12      address TEXT PRIMARY KEY ON CONFLICT REPLACE,
    13      name TEXT DEFAULT "",
    14      color_id DEFAULT "",
    15      emoji VARCHAR DEFAULT "",
    16      visibility INT NOT NULL DEFAULT 0,
    17      sort_order INT DEFAULT 0
    18  );
    19  
    20  CREATE TABLE profile_showcase_collectibles_preferences (
    21      uid TEXT PRIMARY KEY ON CONFLICT REPLACE,
    22      visibility INT NOT NULL DEFAULT 0,
    23      sort_order INT DEFAULT 0
    24  );
    25  
    26  CREATE TABLE profile_showcase_assets_preferences (
    27      symbol TEXT PRIMARY KEY ON CONFLICT REPLACE,
    28      visibility INT NOT NULL DEFAULT 0,
    29      sort_order INT DEFAULT 0
    30  );
    31  
    32  -- Four tables for storing profile showcase for each contact
    33  CREATE TABLE profile_showcase_communities_contacts (
    34      community_id TEXT NOT NULL,
    35      sort_order INT DEFAULT 0,
    36      contact_id TEXT NOT NULL,
    37      PRIMARY KEY (contact_id, community_id)
    38  );
    39  CREATE INDEX profile_showcase_communities_contact_id ON profile_showcase_communities_contacts (contact_id);
    40  
    41  CREATE TABLE profile_showcase_accounts_contacts (
    42      address TEXT NOT NULL,
    43      name TEXT DEFAULT "",
    44      color_id DEFAULT "",
    45      emoji VARCHAR DEFAULT "",
    46      sort_order INT DEFAULT 0,
    47      contact_id TEXT NOT NULL,
    48      PRIMARY KEY (contact_id, address)
    49  );
    50  CREATE INDEX profile_showcase_accounts_contact_id ON profile_showcase_accounts_contacts (contact_id);
    51  
    52  CREATE TABLE profile_showcase_collectibles_contacts (
    53      uid TEXT NOT NULL,
    54      sort_order INT DEFAULT 0,
    55      contact_id TEXT NOT NULL,
    56      PRIMARY KEY (contact_id, uid)
    57  );
    58  CREATE INDEX profile_showcase_collectibles_contact_id ON profile_showcase_collectibles_contacts (contact_id);
    59  
    60  CREATE TABLE profile_showcase_assets_contacts (
    61      symbol TEXT NOT NULL,
    62      sort_order INT DEFAULT 0,
    63      contact_id TEXT NOT NULL,
    64      PRIMARY KEY (contact_id, symbol)
    65  );
    66  CREATE INDEX profile_showcase_assets_contact_id ON profile_showcase_assets_contacts (contact_id);