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

     1  -- Recreate tables for storing current user profile showcase collectibles & assets preferences
     2  DROP TABLE profile_showcase_collectibles_preferences;
     3  CREATE TABLE profile_showcase_collectibles_preferences (
     4      contract_address TEXT PRIMARY KEY ON CONFLICT REPLACE,
     5      chain_id UNSIGNED BIGINT NOT NULL,
     6      token_id TEXT NOT NULL,
     7      community_id TEXT DEFAULT "",
     8      account_address TEXT DEFAULT "",
     9      visibility INT NOT NULL DEFAULT 0,
    10      sort_order INT DEFAULT 0
    11  );
    12  
    13  DROP TABLE profile_showcase_assets_preferences;
    14  CREATE TABLE profile_showcase_verified_tokens_preferences (
    15      symbol TEXT PRIMARY KEY ON CONFLICT REPLACE,
    16      visibility INT NOT NULL DEFAULT 0,
    17      sort_order INT DEFAULT 0
    18  );
    19  CREATE TABLE profile_showcase_unverified_tokens_preferences (
    20      contract_address TEXT PRIMARY KEY ON CONFLICT REPLACE,
    21      chain_id UNSIGNED BIGINT NOT NULL,
    22      community_id TEXT DEFAULT "",
    23      visibility INT NOT NULL DEFAULT 0,
    24      sort_order INT DEFAULT 0
    25  );
    26  
    27  -- Recreate tables for storing profile showcase collectibles & assets for each contact
    28  DROP INDEX profile_showcase_collectibles_contact_id;
    29  DROP TABLE profile_showcase_collectibles_contacts;
    30  CREATE TABLE profile_showcase_collectibles_contacts (
    31      contract_address TEXT NOT NULL,
    32      chain_id UNSIGNED BIGINT NOT NULL,
    33      token_id TEXT NOT NULL,
    34      community_id TEXT DEFAULT "",
    35      account_address TEXT DEFAULT "",
    36      sort_order INT DEFAULT 0,
    37      contact_id TEXT NOT NULL,
    38      PRIMARY KEY (contact_id, chain_id, contract_address, token_id)
    39  );
    40  CREATE INDEX profile_showcase_collectibles_contact_id ON profile_showcase_collectibles_contacts (contact_id);
    41  
    42  DROP INDEX profile_showcase_assets_contact_id;
    43  DROP TABLE profile_showcase_assets_contacts;
    44  CREATE TABLE profile_showcase_verified_tokens_contacts (
    45      symbol TEXT DEFAULT "",
    46      sort_order INT DEFAULT 0,
    47      contact_id TEXT NOT NULL,
    48      PRIMARY KEY (contact_id, symbol)
    49  );
    50  CREATE TABLE profile_showcase_unverified_tokens_contacts (
    51      contract_address TEXT NOT NULL,
    52      chain_id UNSIGNED BIGINT NOT NULL,
    53      community_id TEXT DEFAULT "",
    54      sort_order INT DEFAULT 0,
    55      contact_id TEXT NOT NULL,
    56      PRIMARY KEY (contact_id, contract_address)
    57  );
    58  CREATE INDEX profile_showcase_verified_tokens_contact_id ON profile_showcase_verified_tokens_contacts (contact_id);
    59  CREATE INDEX profile_showcase_unverified_tokens_contact_id ON profile_showcase_unverified_tokens_contacts (contact_id);