[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: Command line switch to drop DB tables.
From: |
gnunet |
Subject: |
[libeufin] branch master updated: Command line switch to drop DB tables. |
Date: |
Thu, 10 Dec 2020 16:28:22 +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 377c41d Command line switch to drop DB tables.
377c41d is described below
commit 377c41dfe9f48b2b004ea7b9f133b643620031cf
Author: MS <ms@taler.net>
AuthorDate: Thu Dec 10 16:28:06 2020 +0100
Command line switch to drop DB tables.
---
nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt | 21 ++++++++++++++++++++-
nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 8 +++++++-
sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt | 17 +++++++++++++++++
.../src/main/kotlin/tech/libeufin/sandbox/Main.kt | 6 ++++++
4 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index 4419b40..3c53b0f 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -383,11 +383,30 @@ class NexusScheduledTaskEntity(id: EntityID<Int>) :
IntEntity(id) {
var prevScheduledExecutionSec by
NexusScheduledTasksTable.prevScheduledExecutionSec
}
+fun dbDropTables() {
+ transaction {
+ SchemaUtils.drop(
+ NexusUsersTable,
+ PaymentInitiationsTable,
+ NexusEbicsSubscribersTable,
+ NexusBankAccountsTable,
+ NexusBankTransactionsTable,
+ TalerIncomingPayments,
+ TalerRequestedPayments,
+ NexusBankConnectionsTable,
+ NexusBankMessagesTable,
+ FacadesTable,
+ TalerFacadeStateTable,
+ NexusScheduledTasksTable,
+ OfferedBankAccountsTable
+ )
+ }
+}
+
fun dbCreateTables(dbConnectionString: String) {
Database.connect("$dbConnectionString")
TransactionManager.manager.defaultIsolationLevel =
Connection.TRANSACTION_SERIALIZABLE
transaction {
- addLogger(StdOutSqlLogger)
SchemaUtils.create(
NexusUsersTable,
PaymentInitiationsTable,
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index 56fbbfc..29299c6 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -71,8 +71,14 @@ class ParseCamt : CliktCommand("Parse a camt file") {
}
}
+class DropTables : CliktCommand("Drop all the tables from the database") {
+ override fun run() {
+ dbDropTables()
+ }
+}
+
class Superuser : CliktCommand("Add superuser or change pw") {
- private val dbName by option().default("libeufindb")
+ private val dbName by option().default("jdbc:sqlite://libeufindb")
private val username by argument()
private val password by option().prompt(requireConfirmation = true,
hideInput = true)
override fun run() {
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
index 525383d..bdc97e4 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
@@ -301,6 +301,23 @@ object BankAccountReportsTable : IntIdTable() {
val bankAccount = reference("bankAccount", BankAccountsTable)
}
+fun dbDropTables() {
+ transaction {
+ SchemaUtils.drop(
+ EbicsSubscribersTable,
+ EbicsHostsTable,
+ EbicsDownloadTransactionsTable,
+ EbicsUploadTransactionsTable,
+ EbicsUploadTransactionChunksTable,
+ EbicsOrderSignaturesTable,
+ BankAccountTransactionsTable,
+ BankAccountsTable,
+ BankAccountReportsTable,
+ BankAccountStatementsTable
+ )
+ }
+}
+
fun dbCreateTables(dbConnectionString: String) {
Database.connect("${dbConnectionString}")
TransactionManager.manager.defaultIsolationLevel =
Connection.TRANSACTION_SERIALIZABLE
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index f725656..fdd9f22 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -92,6 +92,12 @@ class SandboxCommand : CliktCommand() {
override fun run() = Unit
}
+class DropTables : CliktCommand("Drop all the tables from the database") {
+ override fun run() {
+ dbDropTables()
+ }
+}
+
class Serve : CliktCommand("Run sandbox HTTP server") {
private val dbName by option().default("libeufindb")
private val logLevel by option()
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: Command line switch to drop DB tables.,
gnunet <=