desktop: fix postgres migration (#5739)

This commit is contained in:
spaced4ndy 2025-03-10 14:54:55 +04:00 committed by GitHub
parent 16cf91902c
commit 2317cee3eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -79,7 +79,11 @@ suspend fun initChatController(useKey: String? = null, confirmMigrations: Migrat
}
if (rerunMigration) {
chatModel.dbMigrationInProgress.value = true
migrated = chatMigrateInit(dbAbsolutePrefixPath, dbKey, confirm.value)
migrated = if (databaseBackend == "postgres") {
chatMigrateInit("simplex_v1", "postgresql://simplex@/simplex_v1", confirm.value)
} else {
chatMigrateInit(dbAbsolutePrefixPath, dbKey, confirm.value)
}
res = runCatching {
json.decodeFromString<DBMigrationResult>(migrated[0] as String)
}.getOrElse { DBMigrationResult.Unknown(migrated[0] as String) }