gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: Migrating to Postgresql..


From: gnunet
Subject: [libeufin] branch master updated: Migrating to Postgresql..
Date: Tue, 08 Dec 2020 11:02:14 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 9fd8d89  Migrating to Postgresql..
9fd8d89 is described below

commit 9fd8d89cfbc06370bbd6cff8a4386af4fedb9d24
Author: MS <ms@taler.net>
AuthorDate: Tue Dec 8 11:02:04 2020 +0100

    Migrating to Postgresql..
---
 integration-tests/util.py                       | 38 ++++---------------------
 nexus/build.gradle                              |  1 +
 nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt |  2 +-
 3 files changed, 8 insertions(+), 33 deletions(-)

diff --git a/integration-tests/util.py b/integration-tests/util.py
index 83a8722..e2c026a 100644
--- 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
index a6ed9f3..e048a85 100644
--- 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
index c50a4ad..f2a2c36 100644
--- 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)

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]