mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-23 10:43:05 +00:00
desktop: run with postgres backend (#5604)
* desktop: postgres * update * update * params, instruction * script passes (app doesn't build) * fix script
This commit is contained in:
1 parent
75685df2e8
commit
75388b997e
6 files changed
+60
-16
No files matched your search
@@ -154,6 +154,7 @@ buildConfig {
|
||||
buildConfigField("int", "ANDROID_VERSION_CODE", "${extra["android.version_code"]}")
|
||||
buildConfigField("String", "DESKTOP_VERSION_NAME", "\"${extra["desktop.version_name"]}\"")
|
||||
buildConfigField("int", "DESKTOP_VERSION_CODE", "${extra["desktop.version_code"]}")
|
||||
buildConfigField("String", "DATABASE_BACKEND", "\"${extra["database.backend"]}\"")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -28,6 +28,8 @@ val appVersionInfo: Pair<String, Int?> = if (appPlatform == AppPlatform.ANDROID)
|
||||
else
|
||||
BuildConfigCommon.DESKTOP_VERSION_NAME to BuildConfigCommon.DESKTOP_VERSION_CODE
|
||||
|
||||
val databaseBackend: String = if (appPlatform == AppPlatform.ANDROID) "sqlite" else BuildConfigCommon.DATABASE_BACKEND
|
||||
|
||||
class FifoQueue<E>(private var capacity: Int) : LinkedList<E>() {
|
||||
override fun add(element: E): Boolean {
|
||||
if(size > capacity) removeFirst()
|
||||
|
||||
+5
-1
@@ -63,7 +63,11 @@ suspend fun initChatController(useKey: String? = null, confirmMigrations: Migrat
|
||||
}
|
||||
val dbKey = useKey ?: DatabaseUtils.useDatabaseKey()
|
||||
val confirm = confirmMigrations ?: if (appPreferences.developerTools.get() && appPreferences.confirmDBUpgrades.get()) MigrationConfirmation.Error else MigrationConfirmation.YesUp
|
||||
var migrated: Array<Any> = chatMigrateInit(dbAbsolutePrefixPath, dbKey, MigrationConfirmation.Error.value)
|
||||
var migrated: Array<Any> = if (databaseBackend == "postgres") {
|
||||
chatMigrateInit("simplex_v1", "postgresql://simplex@/simplex_v1", MigrationConfirmation.Error.value)
|
||||
} else {
|
||||
chatMigrateInit(dbAbsolutePrefixPath, dbKey, MigrationConfirmation.Error.value)
|
||||
}
|
||||
var res: DBMigrationResult = runCatching {
|
||||
json.decodeFromString<DBMigrationResult>(migrated[0] as String)
|
||||
}.getOrElse { DBMigrationResult.Unknown(migrated[0] as String) }
|
||||
|
||||
@@ -33,3 +33,6 @@ desktop.version_code=90
|
||||
kotlin.version=1.9.23
|
||||
gradle.plugin.version=8.2.0
|
||||
compose.version=1.7.0
|
||||
|
||||
# Choose sqlite or postgres backend
|
||||
database.backend=sqlite
|
||||
Reference in new issue
Block a user