diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-11-10 17:22:31 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-11-10 17:22:44 +0100 |
commit | 9508cb1806608274262f70efee9d43630b81ccd3 (patch) | |
tree | a475e295aa36dd165278bd36a2a75d2ff3469512 /src/auditordb/plugin_auditordb_postgres.c | |
parent | 0e68462e9040c2cbb536d0b0f797fa2e7aab064a (diff) |
ensure we do not start if the database version is outdated (#9203)
Diffstat (limited to 'src/auditordb/plugin_auditordb_postgres.c')
-rw-r--r-- | src/auditordb/plugin_auditordb_postgres.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c index 6cbc0bf7b..4b3bf8c92 100644 --- a/src/auditordb/plugin_auditordb_postgres.c +++ b/src/auditordb/plugin_auditordb_postgres.c @@ -315,11 +315,12 @@ setup_connection (struct PostgresClosure *pg) GNUNET_PQ_reconnect_if_down (pg->conn); return GNUNET_OK; } - db_conn = GNUNET_PQ_connect_with_cfg (pg->cfg, - "auditordb-postgres", - NULL, - es, - NULL); + db_conn = GNUNET_PQ_connect_with_cfg2 (pg->cfg, + "auditordb-postgres", + "auditor-", + es, + NULL, /* prepared statements */ + GNUNET_PQ_FLAG_CHECK_CURRENT); if (NULL == db_conn) return GNUNET_SYSERR; pg->conn = db_conn; @@ -346,15 +347,10 @@ postgres_preflight (void *cls) GNUNET_PQ_EXECUTE_STATEMENT_END }; - if (NULL == pg->conn) - { - if (GNUNET_OK != - setup_connection (pg)) - { - GNUNET_break (0); - return GNUNET_SYSERR; - } - } + if ( (NULL == pg->conn) && + (GNUNET_OK != + setup_connection (pg)) ) + return GNUNET_SYSERR; if (NULL == pg->transaction_name) return GNUNET_OK; /* all good */ if (GNUNET_OK == @@ -524,8 +520,6 @@ libtaler_plugin_auditordb_postgres_init (void *cls) return NULL; } - // MARK: CRUD - plugin = GNUNET_new (struct TALER_AUDITORDB_Plugin); plugin->cls = pg; plugin->preflight = &postgres_preflight; |