gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: need connection string to drop tables


From: gnunet
Subject: [libeufin] branch master updated: need connection string to drop tables with command
Date: Thu, 10 Dec 2020 16:47:19 +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 7529280  need connection string to drop tables with command
7529280 is described below

commit 7529280def4b7d80c3a214fae97042a4c9848bc3
Author: MS <ms@taler.net>
AuthorDate: Thu Dec 10 16:46:44 2020 +0100

    need connection string to drop tables with command
---
 integration-tests/util.py                             | 4 ++--
 nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt       | 3 ++-
 nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt     | 7 ++++---
 sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt   | 3 ++-
 sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 9 ++++-----
 5 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/integration-tests/util.py b/integration-tests/util.py
index a4c053d..83b63bf 100644
--- a/integration-tests/util.py
+++ b/integration-tests/util.py
@@ -65,7 +65,7 @@ def dropSandboxTables(dbName):
         "-q", "--console=plain",
         "-p", "..",
         "sandbox:run",
-        f"--args=drop-tables --db-name={dbName}",
+        f"--args=drop-tables",
     ])
 
 
@@ -75,7 +75,7 @@ def dropNexusTables(dbName):
         "-q", "--console=plain",
         "-p", "..",
         "nexus:run",
-        f"--args=drop-tables --db-name={dbName}",
+        f"--args=drop-tables",
     ])
 
 
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index 3c53b0f..81d69c0 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -383,7 +383,8 @@ class NexusScheduledTaskEntity(id: EntityID<Int>) : 
IntEntity(id) {
     var prevScheduledExecutionSec by 
NexusScheduledTasksTable.prevScheduledExecutionSec
 }
 
-fun dbDropTables() {
+fun dbDropTables(dbConnectionString: String) {
+    Database.connect("$dbConnectionString")
     transaction {
         SchemaUtils.drop(
             NexusUsersTable,
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index f5a4d0d..0ef3602 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -51,12 +51,12 @@ class Serve : CliktCommand("Run nexus HTTP server") {
             helpFormatter = CliktHelpFormatter(showDefaultValues = true)
         }
     }
-    private val dbName by option().default("jdbc:sqlite://libeufindb")
+    private val dbConnString by option().default("jdbc:sqlite://libeufindb")
     private val host by option().default("127.0.0.1")
     private val logLevel by option()
     override fun run() {
         setLogLevel(logLevel)
-        serverMain(dbName, host)
+        serverMain(dbConnString, host)
     }
 }
 
@@ -72,8 +72,9 @@ class ParseCamt : CliktCommand("Parse a camt file") {
 }
 
 class DropTables : CliktCommand("Drop all the tables from the database") {
+    private val dbConnString by option().default("jdbc:sqlite://libeufindb")
     override fun run() {
-        dbDropTables()
+        dbDropTables(dbConnString)
     }
 }
 
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
index bdc97e4..aaa09fe 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
@@ -301,7 +301,8 @@ object BankAccountReportsTable : IntIdTable() {
     val bankAccount = reference("bankAccount", BankAccountsTable)
 }
 
-fun dbDropTables() {
+fun dbDropTables(dbConnectionString: String) {
+    Database.connect("${dbConnectionString}")
     transaction {
         SchemaUtils.drop(
             EbicsSubscribersTable,
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 2a98117..c93cab9 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -60,8 +60,6 @@ import com.github.ajalt.clikt.core.subcommands
 import com.github.ajalt.clikt.parameters.options.default
 import com.github.ajalt.clikt.parameters.options.option
 import io.ktor.request.*
-import io.ktor.util.AttributeKey
-import tech.libeufin.sandbox.BankAccountTransactionsTable
 import tech.libeufin.sandbox.BankAccountTransactionsTable.amount
 import tech.libeufin.sandbox.BankAccountTransactionsTable.creditorBic
 import tech.libeufin.sandbox.BankAccountTransactionsTable.creditorIban
@@ -93,18 +91,19 @@ class SandboxCommand : CliktCommand() {
 }
 
 class DropTables : CliktCommand("Drop all the tables from the database") {
+    private val dbConnString by option().default("jdbc:sqlite://libeufindb")
     override fun run() {
-        dbDropTables()
+        dbDropTables(dbConnString)
     }
 }
 
 class Serve : CliktCommand("Run sandbox HTTP server") {
-    private val dbName by option().default("jdbc:sqlite://libeufindb")
+    private val dbConnString by option().default("jdbc:sqlite://libeufindb")
     private val logLevel by option()
     override fun run() {
         LOGGER = LoggerFactory.getLogger("tech.libeufin.sandbox")
         setLogLevel(logLevel)
-        serverMain(dbName)
+        serverMain(dbConnString)
     }
 }
 

-- 
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]