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

     1  
     2  -- Create tables for storing social links in the prodile showcase
     3  CREATE TABLE profile_showcase_social_links_preferences (
     4      url VARCHAR NOT NULL CHECK (length(trim(url)) > 0),
     5      text VARCHAR NOT NULL CHECK (length(trim(text)) > 0),
     6      visibility INT NOT NULL DEFAULT 0,
     7      sort_order INT DEFAULT 0,
     8      PRIMARY KEY (text, url)
     9  );
    10  
    11  CREATE TABLE profile_showcase_social_links_contacts (
    12      url VARCHAR NOT NULL CHECK (length(trim(url)) > 0),
    13      text VARCHAR NOT NULL CHECK (length(trim(text)) > 0),
    14      sort_order INT DEFAULT 0,
    15      contact_id TEXT NOT NULL,
    16      PRIMARY KEY (contact_id, text, url)
    17  );
    18  CREATE INDEX profile_showcase_social_links_contact_id ON profile_showcase_social_links_contacts (contact_id);
    19  
    20  -- Copy existing social links to a new table
    21  INSERT INTO profile_showcase_social_links_preferences (text, url, sort_order)
    22      SELECT text, url, position
    23      FROM profile_social_links;