mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-29 07:38:54 +00:00
use domains for relay data, path is fixed
This commit is contained in:
@@ -99,8 +99,8 @@ module Simplex.Chat.Store.Groups
|
||||
createRelayRequestGroup,
|
||||
updateRelayOwnStatusFromTo,
|
||||
updateRelayOwnStatus_,
|
||||
getRelaySentWebUrl,
|
||||
updateRelaySentWebUrl,
|
||||
getRelaySentWebDomain,
|
||||
updateRelaySentWebDomain,
|
||||
isRelayGroupRejected,
|
||||
allowRelayGroup,
|
||||
getRelayServedGroups,
|
||||
@@ -1644,13 +1644,13 @@ updateRelayOwnStatus_ db GroupInfo {groupId} relayStatus = do
|
||||
let inactiveAt_ = if relayStatus == RSInactive then Just currentTs else Nothing
|
||||
DB.execute db "UPDATE groups SET relay_own_status = ?, relay_inactive_at = ?, updated_at = ? WHERE group_id = ?" (relayStatus, inactiveAt_, currentTs, groupId)
|
||||
|
||||
getRelaySentWebUrl :: DB.Connection -> GroupInfo -> IO (Maybe Text)
|
||||
getRelaySentWebUrl db GroupInfo {groupId} =
|
||||
join <$> maybeFirstRow fromOnly (DB.query db "SELECT relay_sent_web_url FROM groups WHERE group_id = ?" (Only groupId))
|
||||
getRelaySentWebDomain :: DB.Connection -> GroupInfo -> IO (Maybe Text)
|
||||
getRelaySentWebDomain db GroupInfo {groupId} =
|
||||
join <$> maybeFirstRow fromOnly (DB.query db "SELECT relay_sent_web_domain FROM groups WHERE group_id = ?" (Only groupId))
|
||||
|
||||
updateRelaySentWebUrl :: DB.Connection -> GroupInfo -> Maybe Text -> IO ()
|
||||
updateRelaySentWebUrl db GroupInfo {groupId} webUrl =
|
||||
DB.execute db "UPDATE groups SET relay_sent_web_url = ? WHERE group_id = ?" (webUrl, groupId)
|
||||
updateRelaySentWebDomain :: DB.Connection -> GroupInfo -> Maybe Text -> IO ()
|
||||
updateRelaySentWebDomain db GroupInfo {groupId} webDomain_ =
|
||||
DB.execute db "UPDATE groups SET relay_sent_web_domain = ? WHERE group_id = ?" (webDomain_, groupId)
|
||||
|
||||
-- Flip every RSRejected row sharing the targeted group's relay_request_group_link
|
||||
-- to RSInactive in one statement; returns the refreshed GroupInfo for the targeted groupId.
|
||||
|
||||
@@ -35,7 +35,7 @@ import Simplex.Chat.Store.Postgres.Migrations.M20260515_public_group_access
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260529_delivery_job_senders
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260530_client_services
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260531_member_removed_at
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260531_relay_sent_web_url
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260531_relay_sent_web_domain
|
||||
import Simplex.Messaging.Agent.Store.Shared (Migration (..))
|
||||
|
||||
schemaMigrations :: [(String, Text, Maybe Text)]
|
||||
@@ -71,7 +71,7 @@ schemaMigrations =
|
||||
("20260529_delivery_job_senders", m20260529_delivery_job_senders, Just down_m20260529_delivery_job_senders),
|
||||
("20260530_client_services", m20260530_client_services, Just down_m20260530_client_services),
|
||||
("20260531_member_removed_at", m20260531_member_removed_at, Just down_m20260531_member_removed_at),
|
||||
("20260531_relay_sent_web_url", m20260531_relay_sent_web_url, Just down_m20260531_relay_sent_web_url)
|
||||
("20260531_relay_sent_web_domain", m20260531_relay_sent_web_domain, Just down_m20260531_relay_sent_web_domain)
|
||||
]
|
||||
|
||||
-- | The list of migrations in ascending order by date
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Store.Postgres.Migrations.M20260531_relay_sent_web_domain where
|
||||
|
||||
import Data.Text (Text)
|
||||
import Text.RawString.QQ (r)
|
||||
|
||||
m20260531_relay_sent_web_domain :: Text
|
||||
m20260531_relay_sent_web_domain =
|
||||
[r|
|
||||
ALTER TABLE groups ADD COLUMN relay_sent_web_domain TEXT;
|
||||
|]
|
||||
|
||||
down_m20260531_relay_sent_web_domain :: Text
|
||||
down_m20260531_relay_sent_web_domain =
|
||||
[r|
|
||||
ALTER TABLE groups DROP COLUMN relay_sent_web_domain;
|
||||
|]
|
||||
@@ -1,19 +0,0 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Store.Postgres.Migrations.M20260531_relay_sent_web_url where
|
||||
|
||||
import Data.Text (Text)
|
||||
import Text.RawString.QQ (r)
|
||||
|
||||
m20260531_relay_sent_web_url :: Text
|
||||
m20260531_relay_sent_web_url =
|
||||
[r|
|
||||
ALTER TABLE groups ADD COLUMN relay_sent_web_url TEXT;
|
||||
|]
|
||||
|
||||
down_m20260531_relay_sent_web_url :: Text
|
||||
down_m20260531_relay_sent_web_url =
|
||||
[r|
|
||||
ALTER TABLE groups DROP COLUMN relay_sent_web_url;
|
||||
|]
|
||||
@@ -158,7 +158,7 @@ import Simplex.Chat.Store.SQLite.Migrations.M20260515_public_group_access
|
||||
import Simplex.Chat.Store.SQLite.Migrations.M20260529_delivery_job_senders
|
||||
import Simplex.Chat.Store.SQLite.Migrations.M20260530_client_services
|
||||
import Simplex.Chat.Store.SQLite.Migrations.M20260531_member_removed_at
|
||||
import Simplex.Chat.Store.SQLite.Migrations.M20260531_relay_sent_web_url
|
||||
import Simplex.Chat.Store.SQLite.Migrations.M20260531_relay_sent_web_domain
|
||||
import Simplex.Messaging.Agent.Store.Shared (Migration (..))
|
||||
|
||||
schemaMigrations :: [(String, Query, Maybe Query)]
|
||||
@@ -317,7 +317,7 @@ schemaMigrations =
|
||||
("20260529_delivery_job_senders", m20260529_delivery_job_senders, Just down_m20260529_delivery_job_senders),
|
||||
("20260530_client_services", m20260530_client_services, Just down_m20260530_client_services),
|
||||
("20260531_member_removed_at", m20260531_member_removed_at, Just down_m20260531_member_removed_at),
|
||||
("20260531_relay_sent_web_url", m20260531_relay_sent_web_url, Just down_m20260531_relay_sent_web_url)
|
||||
("20260531_relay_sent_web_domain", m20260531_relay_sent_web_domain, Just down_m20260531_relay_sent_web_domain)
|
||||
]
|
||||
|
||||
-- | The list of migrations in ascending order by date
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Store.SQLite.Migrations.M20260531_relay_sent_web_domain where
|
||||
|
||||
import Database.SQLite.Simple (Query)
|
||||
import Database.SQLite.Simple.QQ (sql)
|
||||
|
||||
m20260531_relay_sent_web_domain :: Query
|
||||
m20260531_relay_sent_web_domain =
|
||||
[sql|
|
||||
ALTER TABLE groups ADD COLUMN relay_sent_web_domain TEXT;
|
||||
|]
|
||||
|
||||
down_m20260531_relay_sent_web_domain :: Query
|
||||
down_m20260531_relay_sent_web_domain =
|
||||
[sql|
|
||||
ALTER TABLE groups DROP COLUMN relay_sent_web_domain;
|
||||
|]
|
||||
@@ -1,18 +0,0 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Store.SQLite.Migrations.M20260531_relay_sent_web_url where
|
||||
|
||||
import Database.SQLite.Simple (Query)
|
||||
import Database.SQLite.Simple.QQ (sql)
|
||||
|
||||
m20260531_relay_sent_web_url :: Query
|
||||
m20260531_relay_sent_web_url =
|
||||
[sql|
|
||||
ALTER TABLE groups ADD COLUMN relay_sent_web_url TEXT;
|
||||
|]
|
||||
|
||||
down_m20260531_relay_sent_web_url :: Query
|
||||
down_m20260531_relay_sent_web_url =
|
||||
[sql|
|
||||
ALTER TABLE groups DROP COLUMN relay_sent_web_url;
|
||||
|]
|
||||
Reference in New Issue
Block a user