commit 9fd8d89cfbc06370bbd6cff8a4386af4fedb9d24
parent f1ca33ce6599a202c4dba36db80ea9b27e7da56e
Author: MS <ms@taler.net>
Date: Tue, 8 Dec 2020 11:02:04 +0100
Migrating to Postgresql..
Diffstat:
3 files changed, 8 insertions(+), 33 deletions(-)
diff --git a/integration-tests/util.py b/integration-tests/util.py
@@ -64,41 +64,15 @@ def makeNexusSuperuser(dbName):
]
)
-def flushTablesSandbox(dbName):
+def drop_public_schema(dbName):
check_call(
- ["psql", "-d", dbName,
- "-c", "DELETE FROM BankAccountReports",
- "-c", "DELETE FROM EbicsOrderSignatures",
- "-c", "DELETE FROM BankAccountStatements",
- "-c", "DELETE FROM EbicsSubscriberPublicKeys",
- "-c", "DELETE FROM BankAccountTransactions",
- "-c", "DELETE FROM EbicsSubscribers",
- "-c", "DELETE FROM BankAccounts",
- "-c", "DELETE FROM EbicsUploadTransactionChunks",
- "-c", "DELETE FROM EbicsDownloadTransactions",
- "-c", "DELETE FROM EbicsUploadTransactions",
- "-c", "DELETE FROM EbicsHosts"
- ]
+ ["psql", "-d", dbName, "-c", "DROP SCHEMA public CASCADE; CREATE SCHEMA public;"]
)
+def flushTablesSandbox(dbName):
+ drop_public_schema(dbName)
def flushTablesNexus(dbName):
- check_call(
- ["psql", "-d", dbName,
- "-c", "DELETE FROM EbicsSubscribers",
- "-c", "DELETE FROM NexusBankTransactions",
- "-c", "DELETE FROM TalerFacadeState",
- "-c", "DELETE FROM Facades",
- "-c", "DELETE FROM NexusScheduledTasks",
- "-c", "DELETE FROM TalerIncomingPayments",
- "-c", "DELETE FROM NexusBankAccounts",
- "-c", "DELETE FROM NexusUsers",
- "-c", "DELETE FROM TalerRequestedPayments",
- "-c", "DELETE FROM NexusBankConnections",
- "-c", "DELETE FROM OfferedBankAccounts",
- "-c", "DELETE FROM NexusBankMessages",
- "-c", "DELETE FROM PaymentInitiations"
- ]
- )
+ drop_public_schema(dbName)
def startSandbox(dbName):
check_call(["../gradlew", "-q", "-p", "..", "sandbox:assemble"])
@@ -137,7 +111,7 @@ def startNexus(dbName):
"..",
"nexus:run",
"--console=plain",
- "--args=serve --db-name={}".format(db_full_path),
+ "--args=serve --db-name={}".format(dbName),
],
stdin=DEVNULL,
stdout=open("nexus-stdout.log", "w"),
diff --git a/nexus/build.gradle b/nexus/build.gradle
@@ -86,6 +86,7 @@ dependencies {
// Database connection driver
implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.28.0'
+ implementation "org.postgresql:postgresql:42.2.18"
// Ktor, an HTTP client and server library
implementation "io.ktor:ktor-server-core:$ktor_version"
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -385,7 +385,7 @@ class NexusScheduledTaskEntity(id: EntityID<Int>) : IntEntity(id) {
}
fun dbCreateTables(dbName: String) {
- Database.connect("jdbc:postgresql:${dbName}", "org.postgresql.Driver")
+ Database.connect("jdbc:postgresql:${dbName}", "org.postgresql.Driver", user = "libeufin")
TransactionManager.manager.defaultIsolationLevel = Connection.TRANSACTION_SERIALIZABLE
transaction {
addLogger(StdOutSqlLogger)