status-go/protocol/migrations/sqlite/1708440786_profile_showcase_social_links.up.sql
Mikhail Rogachev 7cc4c12642
Feat: Add social links to the profile showcase (#4775)
* feat: add social links to the profile showcase

* fix: deprecate old social links, add synced profile showcase to response
2024-02-26 16:53:40 +03:00

24 lines
906 B
SQL

-- Create tables for storing social links in the prodile showcase
CREATE TABLE profile_showcase_social_links_preferences (
url VARCHAR NOT NULL CHECK (length(trim(url)) > 0),
text VARCHAR NOT NULL CHECK (length(trim(text)) > 0),
visibility INT NOT NULL DEFAULT 0,
sort_order INT DEFAULT 0,
PRIMARY KEY (text, url)
);
CREATE TABLE profile_showcase_social_links_contacts (
url VARCHAR NOT NULL CHECK (length(trim(url)) > 0),
text VARCHAR NOT NULL CHECK (length(trim(text)) > 0),
sort_order INT DEFAULT 0,
contact_id TEXT NOT NULL,
PRIMARY KEY (contact_id, text, url)
);
CREATE INDEX profile_showcase_social_links_contact_id ON profile_showcase_social_links_contacts (contact_id);
-- Copy existing social links to a new table
INSERT INTO profile_showcase_social_links_preferences (text, url, sort_order)
SELECT text, url, position
FROM profile_social_links;