mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-15 06:50:19 +00:00
merge migrations
This commit is contained in:
@@ -53,8 +53,7 @@ import Simplex.Chat.Store.Postgres.Migrations.M20260904_file_badges
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260915_user_badges
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260918_badge_issue_errors
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260923_preferences_json
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260924_conn_pres_header
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260925_member_badge_proofs
|
||||
import Simplex.Chat.Store.Postgres.Migrations.M20260925_badge_bindings
|
||||
import Simplex.Messaging.Agent.Store.Shared (Migration (..))
|
||||
|
||||
schemaMigrations :: [(String, Text, Maybe Text)]
|
||||
@@ -108,8 +107,7 @@ schemaMigrations =
|
||||
("20260915_user_badges", m20260915_user_badges, Just down_m20260915_user_badges),
|
||||
("20260918_badge_issue_errors", m20260918_badge_issue_errors, Just down_m20260918_badge_issue_errors),
|
||||
("20260923_preferences_json", m20260923_preferences_json, Just down_m20260923_preferences_json),
|
||||
("20260924_conn_pres_header", m20260924_conn_pres_header, Just down_m20260924_conn_pres_header),
|
||||
("20260925_member_badge_proofs", m20260925_member_badge_proofs, Just down_m20260925_member_badge_proofs)
|
||||
("20260925_badge_bindings", m20260925_badge_bindings, Just down_m20260925_badge_bindings)
|
||||
]
|
||||
|
||||
-- | The list of migrations in ascending order by date
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Store.Postgres.Migrations.M20260924_conn_pres_header where
|
||||
|
||||
import Data.Text (Text)
|
||||
import Text.RawString.QQ (r)
|
||||
|
||||
m20260924_conn_pres_header :: Text
|
||||
m20260924_conn_pres_header =
|
||||
[r|
|
||||
ALTER TABLE connections ADD COLUMN pres_header BYTEA;
|
||||
|]
|
||||
|
||||
down_m20260924_conn_pres_header :: Text
|
||||
down_m20260924_conn_pres_header =
|
||||
[r|
|
||||
ALTER TABLE connections DROP COLUMN pres_header;
|
||||
|]
|
||||
+9
-5
@@ -1,14 +1,16 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Store.Postgres.Migrations.M20260925_member_badge_proofs where
|
||||
module Simplex.Chat.Store.Postgres.Migrations.M20260925_badge_bindings where
|
||||
|
||||
import Data.Text (Text)
|
||||
import Text.RawString.QQ (r)
|
||||
|
||||
m20260925_member_badge_proofs :: Text
|
||||
m20260925_member_badge_proofs =
|
||||
m20260925_badge_bindings :: Text
|
||||
m20260925_badge_bindings =
|
||||
[r|
|
||||
ALTER TABLE connections ADD COLUMN pres_header BYTEA;
|
||||
|
||||
ALTER TABLE file_badge_proofs ALTER COLUMN file_id DROP NOT NULL;
|
||||
|
||||
ALTER TABLE file_badge_proofs ADD COLUMN group_member_id BIGINT REFERENCES group_members ON DELETE CASCADE;
|
||||
@@ -16,8 +18,8 @@ ALTER TABLE file_badge_proofs ADD COLUMN group_member_id BIGINT REFERENCES group
|
||||
CREATE UNIQUE INDEX idx_file_badge_proofs_group_member_id ON file_badge_proofs(group_member_id);
|
||||
|]
|
||||
|
||||
down_m20260925_member_badge_proofs :: Text
|
||||
down_m20260925_member_badge_proofs =
|
||||
down_m20260925_badge_bindings :: Text
|
||||
down_m20260925_badge_bindings =
|
||||
[r|
|
||||
DROP INDEX idx_file_badge_proofs_group_member_id;
|
||||
|
||||
@@ -26,4 +28,6 @@ DELETE FROM file_badge_proofs WHERE group_member_id IS NOT NULL;
|
||||
ALTER TABLE file_badge_proofs DROP COLUMN group_member_id;
|
||||
|
||||
ALTER TABLE file_badge_proofs ALTER COLUMN file_id SET NOT NULL;
|
||||
|
||||
ALTER TABLE connections DROP COLUMN pres_header;
|
||||
|]
|
||||
@@ -176,8 +176,7 @@ import Simplex.Chat.Store.SQLite.Migrations.M20260904_file_badges
|
||||
import Simplex.Chat.Store.SQLite.Migrations.M20260915_user_badges
|
||||
import Simplex.Chat.Store.SQLite.Migrations.M20260918_badge_issue_errors
|
||||
import Simplex.Chat.Store.SQLite.Migrations.M20260923_preferences_json
|
||||
import Simplex.Chat.Store.SQLite.Migrations.M20260924_conn_pres_header
|
||||
import Simplex.Chat.Store.SQLite.Migrations.M20260925_member_badge_proofs
|
||||
import Simplex.Chat.Store.SQLite.Migrations.M20260925_badge_bindings
|
||||
import Simplex.Messaging.Agent.Store.Shared (Migration (..))
|
||||
|
||||
schemaMigrations :: [(String, Query, Maybe Query)]
|
||||
@@ -354,8 +353,7 @@ schemaMigrations =
|
||||
("20260915_user_badges", m20260915_user_badges, Just down_m20260915_user_badges),
|
||||
("20260918_badge_issue_errors", m20260918_badge_issue_errors, Just down_m20260918_badge_issue_errors),
|
||||
("20260923_preferences_json", m20260923_preferences_json, Just down_m20260923_preferences_json),
|
||||
("20260924_conn_pres_header", m20260924_conn_pres_header, Just down_m20260924_conn_pres_header),
|
||||
("20260925_member_badge_proofs", m20260925_member_badge_proofs, Just down_m20260925_member_badge_proofs)
|
||||
("20260925_badge_bindings", m20260925_badge_bindings, Just down_m20260925_badge_bindings)
|
||||
]
|
||||
|
||||
-- | The list of migrations in ascending order by date
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Store.SQLite.Migrations.M20260924_conn_pres_header where
|
||||
|
||||
import Database.SQLite.Simple (Query)
|
||||
import Database.SQLite.Simple.QQ (sql)
|
||||
|
||||
m20260924_conn_pres_header :: Query
|
||||
m20260924_conn_pres_header =
|
||||
[sql|
|
||||
ALTER TABLE connections ADD COLUMN pres_header BLOB;
|
||||
|]
|
||||
|
||||
down_m20260924_conn_pres_header :: Query
|
||||
down_m20260924_conn_pres_header =
|
||||
[sql|
|
||||
ALTER TABLE connections DROP COLUMN pres_header;
|
||||
|]
|
||||
+9
-5
@@ -1,13 +1,15 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Simplex.Chat.Store.SQLite.Migrations.M20260925_member_badge_proofs where
|
||||
module Simplex.Chat.Store.SQLite.Migrations.M20260925_badge_bindings where
|
||||
|
||||
import Database.SQLite.Simple (Query)
|
||||
import Database.SQLite.Simple.QQ (sql)
|
||||
|
||||
m20260925_member_badge_proofs :: Query
|
||||
m20260925_member_badge_proofs =
|
||||
m20260925_badge_bindings :: Query
|
||||
m20260925_badge_bindings =
|
||||
[sql|
|
||||
ALTER TABLE connections ADD COLUMN pres_header BLOB;
|
||||
|
||||
PRAGMA writable_schema=1;
|
||||
|
||||
UPDATE sqlite_master
|
||||
@@ -21,8 +23,8 @@ ALTER TABLE file_badge_proofs ADD COLUMN group_member_id INTEGER REFERENCES grou
|
||||
CREATE UNIQUE INDEX idx_file_badge_proofs_group_member_id ON file_badge_proofs(group_member_id);
|
||||
|]
|
||||
|
||||
down_m20260925_member_badge_proofs :: Query
|
||||
down_m20260925_member_badge_proofs =
|
||||
down_m20260925_badge_bindings :: Query
|
||||
down_m20260925_badge_bindings =
|
||||
[sql|
|
||||
DROP INDEX idx_file_badge_proofs_group_member_id;
|
||||
|
||||
@@ -37,4 +39,6 @@ SET sql = replace(sql, 'file_id INTEGER REFERENCES files', 'file_id INTEGER NOT
|
||||
WHERE name = 'file_badge_proofs' AND type = 'table';
|
||||
|
||||
PRAGMA writable_schema=RESET;
|
||||
|
||||
ALTER TABLE connections DROP COLUMN pres_header;
|
||||
|]
|
||||
Reference in New Issue
Block a user