core: contact aliases (#968)

This commit is contained in:
JRoberts
2022-08-24 19:03:43 +04:00
committed by GitHub
parent e6551abc68
commit 53a71cf28c
10 changed files with 147 additions and 77 deletions
@@ -0,0 +1,17 @@
{-# LANGUAGE QuasiQuotes #-}
module Simplex.Chat.Migrations.M20220824_profiles_local_alias where
import Database.SQLite.Simple (Query)
import Database.SQLite.Simple.QQ (sql)
m20220824_profiles_local_alias :: Query
m20220824_profiles_local_alias =
[sql|
PRAGMA ignore_check_constraints=ON;
ALTER TABLE contact_profiles ADD COLUMN local_alias TEXT DEFAULT '' CHECK (local_alias NOT NULL);
UPDATE contact_profiles SET local_alias = '';
PRAGMA ignore_check_constraints=OFF;
|]
+2 -1
View File
@@ -14,7 +14,8 @@ CREATE TABLE contact_profiles(
updated_at TEXT CHECK(updated_at NOT NULL),
image TEXT,
user_id INTEGER DEFAULT NULL REFERENCES users ON DELETE CASCADE,
incognito INTEGER
incognito INTEGER,
local_alias TEXT DEFAULT '' CHECK(local_alias NOT NULL)
);
CREATE INDEX contact_profiles_index ON contact_profiles(
display_name,