aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/database.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2021-05-01 00:40:34 +0200
committerfiaxh <git@lightrise.org>2021-05-01 00:49:38 +0200
commite92ed27317ae398c867c946cf7206b1f0b32f3b4 (patch)
tree395583d61ad4c187d8e17d05002cb63464e95d3c /libdino/src/service/database.vala
parente32b49b68f0256a133ce0295ec2a5de427b9dc58 (diff)
downloaddino-e92ed27317ae398c867c946cf7206b1f0b32f3b4.tar.gz
dino-e92ed27317ae398c867c946cf7206b1f0b32f3b4.zip
Use drop index if exists to help database up-down-grading
Diffstat (limited to 'libdino/src/service/database.vala')
-rw-r--r--libdino/src/service/database.vala10
1 files changed, 5 insertions, 5 deletions
diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala
index 17499404..b4428189 100644
--- a/libdino/src/service/database.vala
+++ b/libdino/src/service/database.vala
@@ -406,21 +406,21 @@ public class Database : Qlite.Database {
}
if (oldVersion < 17) {
try {
- exec("DROP INDEX contentitem_localtime_counterpart_idx");
- exec("CREATE INDEX contentitem_conversation_hide_localtime_time_idx ON content_item (conversation_id, hide, local_time, time)");
+ exec("DROP INDEX IF EXISTS contentitem_localtime_counterpart_idx");
+ exec("CREATE INDEX IF NOT EXISTS contentitem_conversation_hide_localtime_time_idx ON content_item (conversation_id, hide, local_time, time)");
} catch (Error e) {
error("Failed to upgrade to database version 17: %s", e.message);
}
}
if (oldVersion < 18) {
try {
- exec("DROP INDEX contentitem_conversation_hide_localtime_time_idx");
+ exec("DROP INDEX IF EXISTS contentitem_conversation_hide_localtime_time_idx");
exec("CREATE INDEX IF NOT EXISTS contentitem_conversation_hide_time_idx ON content_item (conversation_id, hide, time)");
- exec("DROP INDEX message_account_counterpart_localtime_idx");
+ exec("DROP INDEX IF EXISTS message_account_counterpart_localtime_idx");
exec("CREATE INDEX IF NOT EXISTS message_account_counterpart_time_idx ON message (account_id, counterpart_id, time)");
- exec("DROP INDEX filetransfer_localtime_counterpart_idx");
+ exec("DROP INDEX IF EXISTS filetransfer_localtime_counterpart_idx");
} catch (Error e) {
error("Failed to upgrade to database version 18: %s", e.message);
}