session-foundation / session-ios

A private messenger for iOS.
https://getsession.org
GNU General Public License v3.0
4 stars 3 forks source link

Migration Error in both 2.1.1 and 2.2.0 #118

Closed mstroubadour closed 2 years ago

mstroubadour commented 2 years ago

Same error on both releases, after upgrading from a v1:

[Session] [Migration Error] Migration failed with error: SQLite error 1: table openGroup
has no column named permissions - while executing 'INSERT INTO "openGroup"
("threadId, "server", "roomToken", "publicKey", "name", "isActive", "description",
"imageId", "imageData", "userCount", "infoUpdates", "sequenceNumber",
"inboxLatestMessageId", "outputLatestMessageId", "pollFailureCount",
"permissions") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'
[Version] iOS 13.1.3 2.2.0

[Session] [Migration Error] Migration failed with error: SQLite error 1: table openGroup
has no column named permissions - while executing 'INSERT INTO "openGroup"
("threadId, "server", "roomToken", "publicKey", "name", "isActive", "description",
"imageId", "imageData", "userCount", "infoUpdates", "sequenceNumber",
"inboxLatestMessageId", "outputLatestMessageId", "pollFailureCount",
"permissions") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'
[Version] iOS 13.1.3 2.1.1
mstroubadour commented 2 years ago

According to the log, the failure happens immediately after - or during, not sure if this is multi-threaded - processing some video thumbnails.

The last successful update message in the logfile is "Inserting Threads & Interactions", from here:

https://github.com/oxen-io/session-ios/blob/master/SessionMessagingKit/Database/Migrations/_003_YDBToGRDBMigration.swift#L512

From what I can tell, it then appears to fail on this line:

https://github.com/oxen-io/session-ios/blob/master/SessionMessagingKit/Database/Migrations/_003_YDBToGRDBMigration.swift#L696:L710

mpretty-cyro commented 2 years ago

@mstroubadour Ah yep, thanks for this info - we've seen this issue a couple of times before in other cases, I'll look at putting together a fix which will help prevent it from happening for future migrations as well

mstroubadour commented 2 years ago

This fix has worked for me. After updating to 2.2.1, I was able to successfully migrate the account which failed previously. All prior messages appear to be present and new ones sent in the interim also arrived fine. Thank you!