unite migrations
This commit is contained in:
parent
b26b03c922
commit
0be7a3117a
@ -127,8 +127,7 @@ library
|
|||||||
Simplex.Chat.Migrations.M20231114_remote_control
|
Simplex.Chat.Migrations.M20231114_remote_control
|
||||||
Simplex.Chat.Migrations.M20231126_remote_ctrl_address
|
Simplex.Chat.Migrations.M20231126_remote_ctrl_address
|
||||||
Simplex.Chat.Migrations.M20231207_chat_list_pagination
|
Simplex.Chat.Migrations.M20231207_chat_list_pagination
|
||||||
Simplex.Chat.Migrations.M20231214_item_content_tag
|
Simplex.Chat.Migrations.M20231215_group_history
|
||||||
Simplex.Chat.Migrations.M20231215_recreate_msg_deliveries
|
|
||||||
Simplex.Chat.Mobile
|
Simplex.Chat.Mobile
|
||||||
Simplex.Chat.Mobile.File
|
Simplex.Chat.Mobile.File
|
||||||
Simplex.Chat.Mobile.Shared
|
Simplex.Chat.Mobile.Shared
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
|
|
||||||
module Simplex.Chat.Migrations.M20231214_item_content_tag where
|
|
||||||
|
|
||||||
import Database.SQLite.Simple (Query)
|
|
||||||
import Database.SQLite.Simple.QQ (sql)
|
|
||||||
|
|
||||||
m20231214_item_content_tag :: Query
|
|
||||||
m20231214_item_content_tag =
|
|
||||||
[sql|
|
|
||||||
ALTER TABLE chat_items ADD COLUMN item_content_tag TEXT;
|
|
||||||
|]
|
|
||||||
|
|
||||||
down_m20231214_item_content_tag :: Query
|
|
||||||
down_m20231214_item_content_tag =
|
|
||||||
[sql|
|
|
||||||
ALTER TABLE chat_items DROP COLUMN item_content_tag;
|
|
||||||
|]
|
|
@ -1,13 +1,15 @@
|
|||||||
{-# LANGUAGE QuasiQuotes #-}
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
|
|
||||||
module Simplex.Chat.Migrations.M20231215_recreate_msg_deliveries where
|
module Simplex.Chat.Migrations.M20231215_group_history where
|
||||||
|
|
||||||
import Database.SQLite.Simple (Query)
|
import Database.SQLite.Simple (Query)
|
||||||
import Database.SQLite.Simple.QQ (sql)
|
import Database.SQLite.Simple.QQ (sql)
|
||||||
|
|
||||||
m20231215_recreate_msg_deliveries :: Query
|
m20231215_group_history :: Query
|
||||||
m20231215_recreate_msg_deliveries =
|
m20231215_group_history =
|
||||||
[sql|
|
[sql|
|
||||||
|
ALTER TABLE chat_items ADD COLUMN item_content_tag TEXT;
|
||||||
|
|
||||||
DROP INDEX msg_delivery_events_msg_delivery_id;
|
DROP INDEX msg_delivery_events_msg_delivery_id;
|
||||||
DROP TABLE msg_delivery_events;
|
DROP TABLE msg_delivery_events;
|
||||||
|
|
||||||
@ -42,8 +44,8 @@ CREATE INDEX idx_msg_deliveries_agent_msg_id ON "msg_deliveries"(connection_id,
|
|||||||
|]
|
|]
|
||||||
|
|
||||||
-- msg_deliveries are not repopulated on down migration, as it may cause constraint violations
|
-- msg_deliveries are not repopulated on down migration, as it may cause constraint violations
|
||||||
down_m20231215_recreate_msg_deliveries :: Query
|
down_m20231215_group_history :: Query
|
||||||
down_m20231215_recreate_msg_deliveries =
|
down_m20231215_group_history =
|
||||||
[sql|
|
[sql|
|
||||||
DROP INDEX idx_msg_deliveries_message_id;
|
DROP INDEX idx_msg_deliveries_message_id;
|
||||||
DROP INDEX idx_msg_deliveries_agent_ack_cmd_id;
|
DROP INDEX idx_msg_deliveries_agent_ack_cmd_id;
|
||||||
@ -76,4 +78,6 @@ CREATE TABLE msg_delivery_events (
|
|||||||
UNIQUE (msg_delivery_id, delivery_status)
|
UNIQUE (msg_delivery_id, delivery_status)
|
||||||
);
|
);
|
||||||
CREATE INDEX msg_delivery_events_msg_delivery_id ON msg_delivery_events(msg_delivery_id);
|
CREATE INDEX msg_delivery_events_msg_delivery_id ON msg_delivery_events(msg_delivery_id);
|
||||||
|
|
||||||
|
ALTER TABLE chat_items DROP COLUMN item_content_tag;
|
||||||
|]
|
|]
|
@ -92,8 +92,7 @@ import Simplex.Chat.Migrations.M20231113_group_forward
|
|||||||
import Simplex.Chat.Migrations.M20231114_remote_control
|
import Simplex.Chat.Migrations.M20231114_remote_control
|
||||||
import Simplex.Chat.Migrations.M20231126_remote_ctrl_address
|
import Simplex.Chat.Migrations.M20231126_remote_ctrl_address
|
||||||
import Simplex.Chat.Migrations.M20231207_chat_list_pagination
|
import Simplex.Chat.Migrations.M20231207_chat_list_pagination
|
||||||
import Simplex.Chat.Migrations.M20231214_item_content_tag
|
import Simplex.Chat.Migrations.M20231215_group_history
|
||||||
import Simplex.Chat.Migrations.M20231215_recreate_msg_deliveries
|
|
||||||
import Simplex.Messaging.Agent.Store.SQLite.Migrations (Migration (..))
|
import Simplex.Messaging.Agent.Store.SQLite.Migrations (Migration (..))
|
||||||
|
|
||||||
schemaMigrations :: [(String, Query, Maybe Query)]
|
schemaMigrations :: [(String, Query, Maybe Query)]
|
||||||
@ -186,8 +185,7 @@ schemaMigrations =
|
|||||||
("20231114_remote_control", m20231114_remote_control, Just down_m20231114_remote_control),
|
("20231114_remote_control", m20231114_remote_control, Just down_m20231114_remote_control),
|
||||||
("20231126_remote_ctrl_address", m20231126_remote_ctrl_address, Just down_m20231126_remote_ctrl_address),
|
("20231126_remote_ctrl_address", m20231126_remote_ctrl_address, Just down_m20231126_remote_ctrl_address),
|
||||||
("20231207_chat_list_pagination", m20231207_chat_list_pagination, Just down_m20231207_chat_list_pagination),
|
("20231207_chat_list_pagination", m20231207_chat_list_pagination, Just down_m20231207_chat_list_pagination),
|
||||||
("20231214_item_content_tag", m20231214_item_content_tag, Just down_m20231214_item_content_tag),
|
("20231215_group_history", m20231215_group_history, Just down_m20231215_group_history)
|
||||||
("20231215_recreate_msg_deliveries", m20231215_recreate_msg_deliveries, Just down_m20231215_recreate_msg_deliveries)
|
|
||||||
]
|
]
|
||||||
|
|
||||||
-- | The list of migrations in ascending order by date
|
-- | The list of migrations in ascending order by date
|
||||||
|
@ -75,7 +75,7 @@ skipComparisonForDownMigrations =
|
|||||||
-- on down migration idx_connections_via_contact_uri_hash index moves down to the end of the file
|
-- on down migration idx_connections_via_contact_uri_hash index moves down to the end of the file
|
||||||
"20231019_indexes",
|
"20231019_indexes",
|
||||||
-- table and indexes move down to the end of the file
|
-- table and indexes move down to the end of the file
|
||||||
"20231215_recreate_msg_deliveries"
|
"20231215_group_history"
|
||||||
]
|
]
|
||||||
|
|
||||||
getSchema :: FilePath -> FilePath -> IO String
|
getSchema :: FilePath -> FilePath -> IO String
|
||||||
|
Loading…
Reference in New Issue
Block a user