diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-01-17 12:22:11 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-01-17 12:25:11 +0100 |
commit | d3fb16b38049d61ad5bb5271e43420421dd10d91 (patch) | |
tree | e027e3388ff56c7bea1e9b5c94ee10cf86a92584 /src/exchangedb/plugin_exchangedb_postgres.c | |
parent | 099884ee66fc642179c9ad799a61f0b1a6d8cdc9 (diff) | |
download | exchange-d3fb16b38049d61ad5bb5271e43420421dd10d91.tar.xz |
also cover drop/restart cases with psql logic
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index afdebf927..80f91785c 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -147,39 +147,17 @@ static int postgres_drop_tables (void *cls) { struct PostgresClosure *pc = cls; - struct GNUNET_PQ_ExecuteStatement es[] = { - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS prewire CASCADE;"), - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS payback CASCADE;"), - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS payback_refresh CASCADE;"), - GNUNET_PQ_make_execute ( - "DROP TABLE IF EXISTS aggregation_tracking CASCADE;"), - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS wire_out CASCADE;"), - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS wire_fee CASCADE;"), - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS deposits CASCADE;"), - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS refunds CASCADE;"), - GNUNET_PQ_make_execute ( - "DROP TABLE IF EXISTS refresh_commitments CASCADE;"), - GNUNET_PQ_make_execute ( - "DROP TABLE IF EXISTS refresh_revealed_coins CASCADE;"), - GNUNET_PQ_make_execute ( - "DROP TABLE IF EXISTS refresh_transfer_keys CASCADE;"), - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS known_coins CASCADE;"), - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS reserves_close CASCADE;"), - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS reserves_out CASCADE;"), - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS reserves_in CASCADE;"), - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS reserves CASCADE;"), - GNUNET_PQ_make_execute ( - "DROP TABLE IF EXISTS denomination_revocations CASCADE;"), - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS denominations CASCADE;"), - GNUNET_PQ_make_execute ("DROP SCHEMA IF EXISTS _v CASCADE;"), - GNUNET_PQ_EXECUTE_STATEMENT_END - }; struct GNUNET_PQ_Context *conn; + char *drop_dir; + GNUNET_asprintf (&drop_dir, + "%sdrop", + pc->sql_dir); conn = GNUNET_PQ_connect (pc->connection_cfg_str, + drop_dir, NULL, - es, NULL); + GNUNET_free (drop_dir); if (NULL == conn) return GNUNET_SYSERR; GNUNET_PQ_disconnect (conn); |