gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated: [db] Added initial sql files. [doc]


From: gnunet
Subject: [taler-donau] branch master updated: [db] Added initial sql files. [doc] minor adjustments
Date: Sun, 01 Oct 2023 13:43:08 +0200

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

johannes-casaburi pushed a commit to branch master
in repository donau.

The following commit(s) were added to refs/heads/master by this push:
     new d0a58ae  [db] Added initial sql files. [doc] minor adjustments
d0a58ae is described below

commit d0a58ae5a4fd2c258309d7790d08ea9213d33108
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Sun Oct 1 13:42:06 2023 +0200

    [db] Added initial sql files. [doc] minor adjustments
---
 doc/flows/main.tex                                 |  14 +-
 src/donaudb/0002-account_merges.sql                | 133 ------------
 src/donaudb/0002-batch_deposits.sql                | 154 -------------
 src/donaudb/0002-coin_deposits.sql                 | 157 --------------
 src/donaudb/0002-cs_nonce_locks.sql                |  97 ---------
 src/donaudb/0002-denominations.sql                 |  45 ----
 ...on_revocations.sql => 0002-donau_charities.sql} |  20 +-
 ...tion_revocations.sql => 0002-donau_history.sql} |  14 +-
 ...ocations.sql => 0002-donau_receipts_issued.sql} |  19 +-
 src/donaudb/0002-known_coins.sql                   | 136 ------------
 src/donaudb/0002-reserves.sql                      | 152 -------------
 src/donaudb/0002-reserves_in.sql                   | 142 ------------
 src/donaudb/0002-reserves_out.sql                  | 239 ---------------------
 src/donaudb/0002-wad_in_entries.sql                | 185 ----------------
 src/donaudb/0002-wad_out_entries.sql               | 185 ----------------
 src/donaudb/0002-wads_in.sql                       | 107 ---------
 src/donaudb/0002-wads_out.sql                      | 128 -----------
 17 files changed, 42 insertions(+), 1885 deletions(-)

diff --git a/doc/flows/main.tex b/doc/flows/main.tex
index bf8aae3..5c5dc18 100644
--- a/doc/flows/main.tex
+++ b/doc/flows/main.tex
@@ -80,7 +80,7 @@ The NONCE is used to uniquely distinguish receipts of the 
same value ("create a
 \subsection{Step 2: Charity sends signed receipt to DONAU}
 \begin{enumerate}
   \item The charity verifies that the amount requested for signing is lower or 
equal to the effective amount of the donation.
-  \item The charity signs(EdDSA, more efficient than RSA-based signatures) a 
structure containing all unsigned receipts coming from the donor.
+  \item The charity signs (using EdDSA) a structure containing all unsigned 
receipts coming from the donor.
   \item The charity sends this structure and the signature to the DONAU.
 \end{enumerate}
 
@@ -91,13 +91,13 @@ The NONCE is used to uniquely distinguish receipts of the 
same value ("create a
       \item verifies the charity Signature on the structure.
       \item verifies the signature of every receipt with it's private keys.
       \item increments the current year amount of the charity by the total 
amount of the receipts, if the increment does not exceed the annual limit.
-      \item blind signs (RSA/Schnorr) all the receipts
+      \item blind signs (using RSA/Schnorr) all the receipts
+        \begin{align}
+          s_1' = m_1'^{(d_{E1})} \emph{mod ?}  \\
+          s_2' = m_2'^{(d_{E2})} \emph{mod ?}
+        \end{align}
+      \item sends back the blind signed receipts to the charity
     \end{enumerate}
-  \begin{align}
-    s_1' = m_1'^{(d_{E1})} \emph{mod ?}  \\
-    s_2' = m_2'^{(d_{E2})} \emph{mod ?}
-  \end{align}
-  \item The DONAU sends back the blind signed receipts to the charity
   \item The charity transmits the blind signed receipts to the donor.
   \item The donor unblinds the receipts.
   \begin{align}
diff --git a/src/donaudb/0002-account_merges.sql 
b/src/donaudb/0002-account_merges.sql
deleted file mode 100644
index d9947cd..0000000
--- a/src/donaudb/0002-account_merges.sql
+++ /dev/null
@@ -1,133 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE FUNCTION create_table_account_merges(
-  IN partition_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'account_merges';
-BEGIN
-  PERFORM create_partitioned_table(
-    'CREATE TABLE IF NOT EXISTS %I '
-      '(account_merge_request_serial_id BIGINT GENERATED BY DEFAULT AS 
IDENTITY'
-      ',reserve_pub BYTEA NOT NULL CHECK (LENGTH(reserve_pub)=32)'
-      ',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)'
-      ',purse_pub BYTEA NOT NULL CHECK (LENGTH(purse_pub)=32)'
-      ',wallet_h_payto BYTEA NOT NULL CHECK (LENGTH(wallet_h_payto)=32)'
-      ',PRIMARY KEY (purse_pub)'
-    ') %s ;'
-    ,table_name
-    ,'PARTITION BY HASH (purse_pub)'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_table(
-     'Merge requests where a purse- and account-owner requested merging the 
purse into the account'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'public key of the target reserve'
-    ,'reserve_pub'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'public key of the purse'
-    ,'purse_pub'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'signature by the reserve private key affirming the merge, of type 
TALER_SIGNATURE_WALLET_ACCOUNT_MERGE'
-    ,'reserve_sig'
-    ,table_name
-    ,partition_suffix
-  );
-END
-$$;
-
-
-CREATE FUNCTION constrain_table_account_merges(
-  IN partition_suffix TEXT
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'account_merges';
-BEGIN
-  table_name = concat_ws('_', table_name, partition_suffix);
-
-  -- FIXME: change to materialized index by reserve_pub!?
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || '_by_reserve_pub '
-    'ON ' || table_name || ' '
-    '(reserve_pub);'
-  );
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_account_merge_request_serial_id_key'
-    ' UNIQUE (account_merge_request_serial_id) '
-  );
-END
-$$;
-
-
-CREATE FUNCTION foreign_table_account_merges()
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'account_merges';
-BEGIN
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_foreign_reserve_pub'
-    ' FOREIGN KEY (reserve_pub) '
-    ' REFERENCES reserves (reserve_pub) ON DELETE CASCADE'
-    ',ADD CONSTRAINT ' || table_name || '_foreign_purse_pub'
-    ' FOREIGN KEY (purse_pub) '
-    ' REFERENCES purse_requests (purse_pub)'
-  );
-END
-$$;
-
-
-INSERT INTO donau_tables
-    (name
-    ,version
-    ,action
-    ,partitioned
-    ,by_range)
-  VALUES
-    ('account_merges'
-    ,'donau-0002'
-    ,'create'
-    ,TRUE
-    ,FALSE),
-    ('account_merges'
-    ,'donau-0002'
-    ,'constrain'
-    ,TRUE
-    ,FALSE),
-    ('account_merges'
-    ,'donau-0002'
-    ,'foreign'
-    ,TRUE
-    ,FALSE);
diff --git a/src/donaudb/0002-batch_deposits.sql 
b/src/donaudb/0002-batch_deposits.sql
deleted file mode 100644
index 4439845..0000000
--- a/src/donaudb/0002-batch_deposits.sql
+++ /dev/null
@@ -1,154 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2023 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE FUNCTION create_table_batch_deposits(
-  IN partition_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'batch_deposits';
-BEGIN
-  PERFORM create_partitioned_table(
-    'CREATE TABLE %I'
-      '(batch_deposit_serial_id INT8 GENERATED BY DEFAULT AS IDENTITY'
-      ',shard INT8 NOT NULL'
-      ',charity_pub BYTEA NOT NULL CHECK (LENGTH(charity_pub)=32)'
-      ',wallet_timestamp INT8 NOT NULL'
-      ',donau_timestamp INT8 NOT NULL'
-      ',refund_deadline INT8 NOT NULL'
-      ',wire_deadline INT8 NOT NULL'
-      ',h_contract_terms BYTEA NOT NULL CHECK (LENGTH(h_contract_terms)=64)'
-      ',wallet_data_hash BYTEA CHECK (LENGTH(wallet_data_hash)=64) DEFAULT 
NULL'
-      ',wire_salt BYTEA NOT NULL CHECK (LENGTH(wire_salt)=16)'
-      ',wire_target_h_payto BYTEA CHECK (LENGTH(wire_target_h_payto)=32)'
-      ',policy_details_serial_id INT8'
-      ',policy_blocked BOOLEAN NOT NULL DEFAULT FALSE'
-      ',done BOOLEAN NOT NULL DEFAULT FALSE'
-    ') %s ;'
-    ,table_name
-    ,'PARTITION BY HASH (shard)'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_table(
-    'Information about the contracts for which we have received (batch) 
deposits.'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Used for load sharding in the materialized indices. Should be set based 
on charity_pub. 64-bit value because we need an *unsigned* 32-bit value.'
-    ,'shard'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Unsalted hash of the target bank account; also used to lookup the KYC 
status'
-    ,'wire_target_h_payto'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'hash over data provided by the wallet upon payment to select a more 
specific contract'
-    ,'wallet_data_hash'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Salt used when hashing the payto://-URI to get the h_wire that was used 
by the coin deposit signatures; not used to calculate wire_target_h_payto (as 
that one is unsalted)'
-    ,'wire_salt'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Set to TRUE once we have included this (batch) deposit (and all 
associated coins) in some aggregate wire transfer to the charity'
-    ,'done'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'True if the aggregation of the (batch) deposit is currently blocked by 
some policy extension mechanism. Used to filter out deposits that must not be 
processed by the canonical deposit logic.'
-    ,'policy_blocked'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'References policy extensions table, NULL if extensions are not used'
-    ,'policy_details_serial_id'
-    ,table_name
-    ,partition_suffix
-  );
-END
-$$;
-
-
-CREATE FUNCTION constrain_table_batch_deposits(
-  IN partition_suffix TEXT
-)
-RETURNS void
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'batch_deposits';
-BEGIN
-  table_name = concat_ws('_', table_name, partition_suffix);
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_batch_deposit_serial_id_pkey'
-    ' PRIMARY KEY (batch_deposit_serial_id) '
-    ',ADD CONSTRAINT ' || table_name || '_charity_pub_h_contract_terms'
-    ' UNIQUE (shard, charity_pub, h_contract_terms)'
-    ',ADD CONSTRAINT ' || table_name || '_foreign_policy_details'
-    ' FOREIGN KEY (policy_details_serial_id) '
-    ' REFERENCES policy_details (policy_details_serial_id) ON DELETE RESTRICT'
-  );
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || '_by_ready '
-    'ON ' || table_name || ' '
-    '(shard ASC'
-    ',wire_deadline ASC'
-    ') WHERE NOT (done OR policy_blocked);'
-  );
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || '_for_matching '
-    'ON ' || table_name || ' '
-    '(shard ASC'
-    ',refund_deadline ASC'
-    ',wire_target_h_payto'
-    ') WHERE NOT (done OR policy_blocked);'
-  );
-END
-$$;
-
-
-INSERT INTO donau_tables
-    (name
-    ,version
-    ,action
-    ,partitioned
-    ,by_range)
-  VALUES
-    ('batch_deposits'
-    ,'donau-0002'
-    ,'create'
-    ,TRUE
-    ,FALSE),
-    ('batch_deposits'
-    ,'donau-0002'
-    ,'constrain'
-    ,TRUE
-    ,FALSE)
-    ;
diff --git a/src/donaudb/0002-coin_deposits.sql 
b/src/donaudb/0002-coin_deposits.sql
deleted file mode 100644
index 2a0780b..0000000
--- a/src/donaudb/0002-coin_deposits.sql
+++ /dev/null
@@ -1,157 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2023 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE FUNCTION create_table_coin_deposits(
-  IN partition_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'coin_deposits';
-BEGIN
-  PERFORM create_partitioned_table(
-    'CREATE TABLE %I'
-      '(coin_deposit_serial_id INT8 GENERATED BY DEFAULT AS IDENTITY'
-      ',batch_deposit_serial_id INT8 NOT NULL'
-      ',coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)'
-      ',coin_sig BYTEA NOT NULL CHECK (LENGTH(coin_sig)=64)'
-      ',amount_with_fee taler_amount NOT NULL'
-    ') %s ;'
-    ,table_name
-    ,'PARTITION BY HASH (coin_pub)'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_table(
-    'Coins which have been deposited with the respective per-coin signatures.'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Link to information about the batch deposit this coin was used for'
-    ,'batch_deposit_serial_id'
-    ,table_name
-    ,partition_suffix
-  );
-END
-$$;
-
-
-CREATE FUNCTION constrain_table_coin_deposits(
-  IN partition_suffix TEXT
-)
-RETURNS void
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'coin_deposits';
-BEGIN
-  table_name = concat_ws('_', table_name, partition_suffix);
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_coin_deposit_serial_id_pkey'
-    ' PRIMARY KEY (coin_deposit_serial_id) '
-    ',ADD CONSTRAINT ' || table_name || '_unique_coin_sig'
-    ' UNIQUE (coin_pub, coin_sig)'
-  );
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || '_by_batch '
-    'ON ' || table_name || ' '
-    '(batch_deposit_serial_id);'
-  );
-END
-$$;
-
-
-CREATE FUNCTION foreign_table_coin_deposits()
-RETURNS void
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'coin_deposits';
-BEGIN
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_foreign_coin_pub'
-    ' FOREIGN KEY (coin_pub) '
-    ' REFERENCES known_coins (coin_pub) ON DELETE CASCADE'
-    ',ADD CONSTRAINT ' || table_name || '_foreign_batch_deposits_id'
-    ' FOREIGN KEY (batch_deposit_serial_id) '
-    ' REFERENCES batch_deposits (batch_deposit_serial_id) ON DELETE CASCADE'
-  );
-END
-$$;
-
-
-CREATE OR REPLACE FUNCTION coin_deposits_insert_trigger()
-  RETURNS trigger
-  LANGUAGE plpgsql
-  AS $$
-BEGIN
-  INSERT INTO donau.coin_history
-    (coin_pub
-    ,table_name
-    ,serial_id)
- VALUES
-     (NEW.coin_pub
-    ,'coin_deposits'
-    ,NEW.coin_deposit_serial_id);
-  RETURN NEW;
-END $$;
-COMMENT ON FUNCTION coin_deposits_insert_trigger()
-  IS 'Automatically generate coin history entry.';
-
-
-CREATE FUNCTION master_table_coin_deposits()
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-BEGIN
-  CREATE TRIGGER coin_deposits_on_insert
-    AFTER INSERT
-     ON coin_deposits
-     FOR EACH ROW EXECUTE FUNCTION coin_deposits_insert_trigger();
-END $$;
-
-
-INSERT INTO donau_tables
-    (name
-    ,version
-    ,action
-    ,partitioned
-    ,by_range)
-  VALUES
-    ('coin_deposits'
-    ,'donau-0002'
-    ,'create'
-    ,TRUE
-    ,FALSE),
-    ('coin_deposits'
-    ,'donau-0002'
-    ,'constrain'
-    ,TRUE
-    ,FALSE),
-    ('coin_deposits'
-    ,'donau-0002'
-    ,'foreign'
-    ,TRUE
-    ,FALSE),
-    ('coin_deposits'
-    ,'donau-0002'
-    ,'master'
-    ,TRUE
-    ,FALSE)
-    ;
diff --git a/src/donaudb/0002-cs_nonce_locks.sql 
b/src/donaudb/0002-cs_nonce_locks.sql
deleted file mode 100644
index d911371..0000000
--- a/src/donaudb/0002-cs_nonce_locks.sql
+++ /dev/null
@@ -1,97 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE FUNCTION create_table_cs_nonce_locks(
-  partition_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-BEGIN
-  PERFORM create_partitioned_table(
-    'CREATE TABLE %I'
-      '(cs_nonce_lock_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
-      ',nonce BYTEA PRIMARY KEY CHECK (LENGTH(nonce)=32)'
-      ',op_hash BYTEA NOT NULL CHECK (LENGTH(op_hash)=64)'
-      ',max_denomination_serial INT8 NOT NULL'
-    ') %s ;'
-    ,'cs_nonce_locks'
-    ,'PARTITION BY HASH (nonce)'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_table(
-     'ensures a Clause Schnorr client nonce is locked for use with an 
operation identified by a hash'
-    ,'cs_nonce_locks'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'actual nonce submitted by the client'
-    ,'nonce'
-    ,'cs_nonce_locks'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'hash (RC for refresh, blind coin hash for withdraw) the nonce may be 
used with'
-    ,'op_hash'
-    ,'cs_nonce_locks'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Maximum number of a CS denomination serial the nonce could be used with, 
for GC'
-    ,'max_denomination_serial'
-    ,'cs_nonce_locks'
-    ,partition_suffix
-  );
-END
-$$;
-
-
-CREATE FUNCTION constrain_table_cs_nonce_locks(
-  IN partition_suffix TEXT
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'cs_nonce_locks';
-BEGIN
-  table_name = concat_ws('_', table_name, partition_suffix);
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_cs_nonce_lock_serial_id_key'
-    ' UNIQUE (cs_nonce_lock_serial_id)'
-  );
-END
-$$;
-
-
-INSERT INTO donau_tables
-    (name
-    ,version
-    ,action
-    ,partitioned
-    ,by_range)
-  VALUES
-    ('cs_nonce_locks'
-    ,'donau-0002'
-    ,'create'
-    ,TRUE
-    ,FALSE),
-    ('cs_nonce_locks'
-    ,'donau-0002'
-    ,'constrain'
-    ,TRUE
-    ,FALSE);
diff --git a/src/donaudb/0002-denominations.sql 
b/src/donaudb/0002-denominations.sql
deleted file mode 100644
index a5f2c2a..0000000
--- a/src/donaudb/0002-denominations.sql
+++ /dev/null
@@ -1,45 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE TABLE denominations
-  (denominations_serial BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
-  ,denom_pub_hash BYTEA PRIMARY KEY CHECK (LENGTH(denom_pub_hash)=64)
-  ,denom_type INT4 NOT NULL DEFAULT (1) -- 1 == RSA (for now, remove default 
later!)
-  ,age_mask INT4 NOT NULL DEFAULT (0)
-  ,denom_pub BYTEA NOT NULL
-  ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
-  ,valid_from INT8 NOT NULL
-  ,expire_withdraw INT8 NOT NULL
-  ,expire_deposit INT8 NOT NULL
-  ,expire_legal INT8 NOT NULL
-  ,coin taler_amount NOT NULL
-  ,fee_withdraw taler_amount NOT NULL
-  ,fee_deposit taler_amount NOT NULL
-  ,fee_refresh taler_amount NOT NULL
-  ,fee_refund taler_amount NOT NULL
-  );
-COMMENT ON TABLE denominations
-  IS 'Main denominations table. All the valid denominations the donau knows 
about.';
-COMMENT ON COLUMN denominations.denom_type
-  IS 'determines cipher type for blind signatures used with this denomination; 
0 is for RSA';
-COMMENT ON COLUMN denominations.age_mask
-  IS 'bitmask with the age restrictions that are being used for this 
denomination; 0 if denomination does not support the use of age restrictions';
-COMMENT ON COLUMN denominations.denominations_serial
-  IS 'needed for donau-auditor replication logic';
-
-CREATE INDEX denominations_by_expire_legal_index
-  ON denominations
-  (expire_legal);
diff --git a/src/donaudb/0002-denomination_revocations.sql 
b/src/donaudb/0002-donau_charities.sql
similarity index 54%
copy from src/donaudb/0002-denomination_revocations.sql
copy to src/donaudb/0002-donau_charities.sql
index e19c366..64102d5 100644
--- a/src/donaudb/0002-denomination_revocations.sql
+++ b/src/donaudb/0002-donau_charities.sql
@@ -14,10 +14,18 @@
 -- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
 --
 
-CREATE TABLE IF NOT EXISTS denomination_revocations
-  (denom_revocations_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
-  ,denominations_serial INT8 PRIMARY KEY REFERENCES denominations 
(denominations_serial) ON DELETE CASCADE
-  ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
+CREATE TABLE charities
+  (charity_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
+  ,charity_pub BYTEA PRIMARY KEY CHECK (LENGTH(donau_pub)=32)
+  ,max_per_year taler_amount NOT NULL
+  ,receipts_to_date taler_amount NOT NULL
+  ,current_year INT8 NOT NULL
   );
-COMMENT ON TABLE denomination_revocations
-  IS 'remembering which denomination keys have been revoked';
+COMMENT ON TABLE charities
+  IS 'Table with master public keys of charities.';
+COMMENT ON COLUMN charities.charity_pub
+  IS 'Public key of the charity.';
+COMMENT ON COLUMN charities.max_per_year
+  IS 'The annual donation limit.';
+COMMENT ON COLUMN charities.receipts_to_date
+  IS 'The current amount of donations in the current year.';
diff --git a/src/donaudb/0002-denomination_revocations.sql 
b/src/donaudb/0002-donau_history.sql
similarity index 64%
copy from src/donaudb/0002-denomination_revocations.sql
copy to src/donaudb/0002-donau_history.sql
index e19c366..92ea5ce 100644
--- a/src/donaudb/0002-denomination_revocations.sql
+++ b/src/donaudb/0002-donau_history.sql
@@ -14,10 +14,12 @@
 -- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
 --
 
-CREATE TABLE IF NOT EXISTS denomination_revocations
-  (denom_revocations_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
-  ,denominations_serial INT8 PRIMARY KEY REFERENCES denominations 
(denominations_serial) ON DELETE CASCADE
-  ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
+CREATE TABLE history
+  (charity_id BIGINT KEY REFERENCES charities (charity_id) ON DELETE CASCADE
+  ,final_amount taler_amount NOT NULL
+  ,year INT8 NOT NULL
   );
-COMMENT ON TABLE denomination_revocations
-  IS 'remembering which denomination keys have been revoked';
+COMMENT ON TABLE history
+  IS 'Table containing the yearly donation amount for each charity.';
+COMMENT ON COLUMN history.final_amount
+  IS 'Final donation amount that the charity received.';
diff --git a/src/donaudb/0002-denomination_revocations.sql 
b/src/donaudb/0002-donau_receipts_issued.sql
similarity index 52%
rename from src/donaudb/0002-denomination_revocations.sql
rename to src/donaudb/0002-donau_receipts_issued.sql
index e19c366..ca4f73b 100644
--- a/src/donaudb/0002-denomination_revocations.sql
+++ b/src/donaudb/0002-donau_receipts_issued.sql
@@ -14,10 +14,17 @@
 -- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
 --
 
-CREATE TABLE IF NOT EXISTS denomination_revocations
-  (denom_revocations_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
-  ,denominations_serial INT8 PRIMARY KEY REFERENCES denominations 
(denominations_serial) ON DELETE CASCADE
-  ,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
+CREATE TABLE receipts_issued
+  (receipt_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
+  ,charity_sig BYTEA CHECK (LENGTH(charity_sig)=64)
+  ,charity_id BIGINT NOT NULL REFERENCES charities (charity_id) ON DELETE 
CASCADE
+  ,receipt_hash BYTEA NOT NULL
+  ,donation_unit_key_id INT8 NOT NULL
+  ,donation_unit_sig BYTEA CHECK (LENGTH(donation_unit_sig)=64)
   );
-COMMENT ON TABLE denomination_revocations
-  IS 'remembering which denomination keys have been revoked';
+COMMENT ON TABLE receipts_issued
+  IS 'Table containing the issued blinded donation receipts to the charity.';
+COMMENT ON COLUMN receipts_issued.charity_sig
+  IS 'Signature from the charity.';
+COMMENT ON COLUMN receipts_issued.receipt_hash
+  IS 'Hash value of the receipt received.';
diff --git a/src/donaudb/0002-known_coins.sql b/src/donaudb/0002-known_coins.sql
deleted file mode 100644
index bebf289..0000000
--- a/src/donaudb/0002-known_coins.sql
+++ /dev/null
@@ -1,136 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-
-CREATE FUNCTION create_table_known_coins(
-  IN partition_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT default 'known_coins';
-BEGIN
-  PERFORM create_partitioned_table(
-    'CREATE TABLE %I'
-      '(known_coin_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
-      ',denominations_serial INT8 NOT NULL'
-      ',coin_pub BYTEA NOT NULL PRIMARY KEY CHECK (LENGTH(coin_pub)=32)'
-      ',age_commitment_hash BYTEA CHECK (LENGTH(age_commitment_hash)=32)'
-      ',denom_sig BYTEA NOT NULL'
-      ',remaining taler_amount NOT NULL DEFAULT(0,0)'
-    ') %s ;'
-    ,table_name
-    ,'PARTITION BY HASH (coin_pub)'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_table(
-     'information about coins and their signatures, so we do not have to store 
the signatures more than once if a coin is involved in multiple operations'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Denomination of the coin, determines the value of the original coin and 
applicable fees for coin-specific operations.'
-    ,'denominations_serial'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'EdDSA public key of the coin'
-    ,'coin_pub'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Value of the coin that remains to be spent'
-    ,'remaining'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Optional hash of the age commitment for age restrictions as per DD 24 
(active if denom_type has the respective bit set)'
-    ,'age_commitment_hash'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'This is the signature of the donau that affirms that the coin is a valid 
coin. The specific signature type depends on denom_type of the denomination.'
-    ,'denom_sig'
-    ,table_name
-    ,partition_suffix
-  );
-END
-$$;
-
-
-CREATE FUNCTION constrain_table_known_coins(
-  IN partition_suffix TEXT
-)
-RETURNS void
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT default 'known_coins';
-BEGIN
-  table_name = concat_ws('_', table_name, partition_suffix);
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_known_coin_id_key'
-    ' UNIQUE (known_coin_id)'
-  );
-END
-$$;
-
-
-CREATE FUNCTION foreign_table_known_coins()
-RETURNS void
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT default 'known_coins';
-BEGIN
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_foreign_denominations'
-    ' FOREIGN KEY (denominations_serial) '
-    ' REFERENCES denominations (denominations_serial) ON DELETE CASCADE'
-  );
-END
-$$;
-
-
-INSERT INTO donau_tables
-    (name
-    ,version
-    ,action
-    ,partitioned
-    ,by_range)
-  VALUES
-    ('known_coins'
-    ,'donau-0002'
-    ,'create'
-    ,TRUE
-    ,FALSE),
-    ('known_coins'
-    ,'donau-0002'
-    ,'constrain'
-    ,TRUE
-    ,FALSE),
-    ('known_coins'
-    ,'donau-0002'
-    ,'foreign'
-    ,TRUE
-    ,FALSE);
diff --git a/src/donaudb/0002-reserves.sql b/src/donaudb/0002-reserves.sql
deleted file mode 100644
index b6060dc..0000000
--- a/src/donaudb/0002-reserves.sql
+++ /dev/null
@@ -1,152 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE FUNCTION create_table_reserves(
-  IN partition_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'reserves';
-BEGIN
-  PERFORM create_partitioned_table(
-    'CREATE TABLE %I'
-      '(reserve_uuid BIGINT GENERATED BY DEFAULT AS IDENTITY'
-      ',reserve_pub BYTEA PRIMARY KEY CHECK(LENGTH(reserve_pub)=32)'
-      ',current_balance taler_amount NOT NULL DEFAULT (0, 0)'
-      ',purses_active INT8 NOT NULL DEFAULT(0)'
-      ',purses_allowed INT8 NOT NULL DEFAULT(0)'
-      ',birthday INT4 NOT NULL DEFAULT(0)'
-      ',expiration_date INT8 NOT NULL'
-      ',gc_date INT8 NOT NULL'
-    ') %s ;'
-    ,table_name
-    ,'PARTITION BY HASH (reserve_pub)'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_table(
-     'Summarizes the balance of a reserve. Updated when new funds are added or 
withdrawn.'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'EdDSA public key of the reserve. Knowledge of the private key implies 
ownership over the balance.'
-    ,'reserve_pub'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Current balance remaining with the reserve.'
-    ,'current_balance'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Number of purses that were created by this reserve that are not expired 
and not fully paid.'
-    ,'purses_active'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Number of purses that this reserve is allowed to have active at most.'
-    ,'purses_allowed'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Used to trigger closing of reserves that have not been drained after 
some time'
-    ,'expiration_date'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Used to forget all information about a reserve during garbage collection'
-    ,'gc_date'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Birthday of the user in days after 1970, or 0 if user is an adult and is 
not subject to age restrictions'
-    ,'birthday'
-    ,table_name
-    ,partition_suffix
-  );
-END
-$$;
-
-
-CREATE FUNCTION constrain_table_reserves(
-  IN partition_suffix TEXT
-)
-RETURNS void
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'reserves';
-BEGIN
-  table_name = concat_ws('_', table_name, partition_suffix);
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_unique_uuid'
-    ' UNIQUE (reserve_uuid)'
-  );
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || '_by_expiration_index '
-    'ON ' || table_name || ' '
-    '(expiration_date'
-    ',current_balance'
-    ');'
-  );
-  EXECUTE FORMAT (
-    'COMMENT ON INDEX ' || table_name || '_by_expiration_index '
-    'IS ' || quote_literal('used in get_expired_reserves') || ';'
-  );
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || '_by_reserve_uuid_index '
-    'ON ' || table_name || ' '
-    '(reserve_uuid);'
-  );
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || '_by_gc_date_index '
-    'ON ' || table_name || ' '
-    '(gc_date);'
-  );
-  EXECUTE FORMAT (
-    'COMMENT ON INDEX ' || table_name || '_by_gc_date_index '
-    'IS ' || quote_literal('for reserve garbage collection') || ';'
-  );
-END
-$$;
-
-
-INSERT INTO donau_tables
-    (name
-    ,version
-    ,action
-    ,partitioned
-    ,by_range)
-  VALUES
-    ('reserves'
-    ,'donau-0002'
-    ,'create'
-    ,TRUE
-    ,FALSE),
-    ('reserves'
-    ,'donau-0002'
-    ,'constrain'
-    ,TRUE
-    ,FALSE);
diff --git a/src/donaudb/0002-reserves_in.sql b/src/donaudb/0002-reserves_in.sql
deleted file mode 100644
index 953ea63..0000000
--- a/src/donaudb/0002-reserves_in.sql
+++ /dev/null
@@ -1,142 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE FUNCTION create_table_reserves_in(
-  IN partition_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT default 'reserves_in';
-BEGIN
-  PERFORM create_partitioned_table(
-    'CREATE TABLE %I'
-      '(reserve_in_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
-      ',reserve_pub BYTEA PRIMARY KEY'
-      ',wire_reference INT8 NOT NULL'
-      ',credit taler_amount NOT NULL'
-      ',wire_source_h_payto BYTEA CHECK (LENGTH(wire_source_h_payto)=32)'
-      ',donau_account_section TEXT NOT NULL'
-      ',execution_date INT8 NOT NULL'
-    ') %s ;'
-    ,table_name
-    ,'PARTITION BY HASH (reserve_pub)'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_table(
-     'list of transfers of funds into the reserves, one per incoming wire 
transfer'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Identifies the debited bank account and KYC status'
-    ,'wire_source_h_payto'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Public key of the reserve. Private key signifies ownership of the 
remaining balance.'
-    ,'reserve_pub'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Amount that was transferred into the reserve'
-    ,'credit'
-    ,table_name
-    ,partition_suffix
-  );
-END $$;
-
-
-CREATE FUNCTION constrain_table_reserves_in(
-  IN partition_suffix TEXT
-)
-RETURNS void
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT default 'reserves_in';
-BEGIN
-  table_name = concat_ws('_', table_name, partition_suffix);
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_reserve_in_serial_id_key'
-    ' UNIQUE (reserve_in_serial_id)'
-  );
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || '_by_reserve_in_serial_id_index '
-    'ON ' || table_name || ' '
-    '(reserve_in_serial_id);'
-  );
-  -- FIXME: where do we need this index? Can we do better?
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || 
'_by_exch_accnt_section_execution_date_idx '
-    'ON ' || table_name || ' '
-    '(donau_account_section '
-    ',execution_date'
-    ');'
-  );
-  -- FIXME: where do we need this index? Can we do better?
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || '_by_exch_accnt_reserve_in_serial_id_idx '
-    'ON ' || table_name || ' '
-    '(donau_account_section'
-    ',reserve_in_serial_id DESC'
-    ');'
-  );
-END
-$$;
-
-CREATE FUNCTION foreign_table_reserves_in()
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'reserves_in';
-BEGIN
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_foreign_reserve_pub'
-    ' FOREIGN KEY (reserve_pub) '
-    ' REFERENCES reserves(reserve_pub) ON DELETE CASCADE'
-  );
-END $$;
-
-
-INSERT INTO donau_tables
-    (name
-    ,version
-    ,action
-    ,partitioned
-    ,by_range)
-  VALUES
-    ('reserves_in'
-    ,'donau-0002'
-    ,'create'
-    ,TRUE
-    ,FALSE),
-    ('reserves_in'
-    ,'donau-0002'
-    ,'constrain'
-    ,TRUE
-    ,FALSE),
-    ('reserves_in'
-    ,'donau-0002'
-    ,'foreign'
-    ,TRUE
-    ,FALSE);
diff --git a/src/donaudb/0002-reserves_out.sql 
b/src/donaudb/0002-reserves_out.sql
deleted file mode 100644
index d2c67f9..0000000
--- a/src/donaudb/0002-reserves_out.sql
+++ /dev/null
@@ -1,239 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE FUNCTION create_table_reserves_out(
-  IN partition_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT default 'reserves_out';
-BEGIN
-  PERFORM create_partitioned_table(
-    'CREATE TABLE %I'
-      '(reserve_out_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
-      ',h_blind_ev BYTEA CHECK (LENGTH(h_blind_ev)=64) UNIQUE'
-      ',denominations_serial INT8 NOT NULL'
-      ',denom_sig BYTEA NOT NULL'
-      ',reserve_uuid INT8 NOT NULL'
-      ',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)'
-      ',execution_date INT8 NOT NULL'
-      ',amount_with_fee taler_amount NOT NULL'
-    ') %s ;'
-    ,'reserves_out'
-    ,'PARTITION BY HASH (h_blind_ev)'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_table (
-     'Withdraw operations performed on reserves.'
-    ,'reserves_out'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column (
-     'Hash of the blinded coin, used as primary key here so that broken 
clients that use a non-random coin or blinding factor fail to withdraw 
(otherwise they would fail on deposit when the coin is not unique there).'
-    ,'h_blind_ev'
-    ,'reserves_out'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column (
-     'We do not CASCADE ON DELETE for the foreign constrain here, as we may 
keep the denomination data alive'
-    ,'denominations_serial'
-    ,'reserves_out'
-    ,partition_suffix
-  );
-END
-$$;
-
-
-CREATE FUNCTION constrain_table_reserves_out(
-  IN partition_suffix TEXT
-)
-RETURNS void
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT default 'reserves_out';
-BEGIN
-  table_name = concat_ws('_', table_name, partition_suffix);
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_reserve_out_serial_id_key'
-    ' UNIQUE (reserve_out_serial_id)'
-  );
-  -- FIXME: change query to use reserves_out_by_reserve instead and 
materialize execution_date there as well???
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || 
'_by_reserve_uuid_and_execution_date_index '
-    'ON ' || table_name || ' '
-    '(reserve_uuid, execution_date);'
-  );
-  EXECUTE FORMAT (
-    'COMMENT ON INDEX ' || table_name || 
'_by_reserve_uuid_and_execution_date_index '
-    'IS ' || quote_literal('for get_reserves_out and 
donau_do_withdraw_limit_check') || ';'
-  );
-END
-$$;
-
-
-CREATE FUNCTION foreign_table_reserves_out()
-RETURNS void
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT default 'reserves_out';
-BEGIN
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_foreign_denom'
-    ' FOREIGN KEY (denominations_serial)'
-    ' REFERENCES denominations (denominations_serial)'
-    ',ADD CONSTRAINT ' || table_name || '_foreign_reserve '
-    ' FOREIGN KEY (reserve_uuid)'
-    ' REFERENCES reserves (reserve_uuid) ON DELETE CASCADE'
-  );
-END
-$$;
-
-
-CREATE FUNCTION create_table_reserves_out_by_reserve(
-  IN partition_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'reserves_out_by_reserve';
-BEGIN
-  PERFORM create_partitioned_table(
-  'CREATE TABLE %I'
-    '(reserve_uuid INT8 NOT NULL' -- REFERENCES reserves (reserve_uuid) ON 
DELETE CASCADE
-    ',h_blind_ev BYTEA CHECK (LENGTH(h_blind_ev)=64)'
-    ') %s '
-    ,table_name
-    ,'PARTITION BY HASH (reserve_uuid)'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_table (
-     'Information in this table is strictly redundant with that of 
reserves_out, but saved by a different primary key for fast lookups by reserve 
public key/uuid.'
-    ,table_name
-    ,partition_suffix
-  );
-END $$;
-
-
-CREATE FUNCTION constrain_table_reserves_out_by_reserve(
-  IN partition_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'reserves_out_by_reserve';
-BEGIN
-  table_name = concat_ws('_', table_name, partition_suffix);
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || '_main_index '
-    'ON ' || table_name || ' '
-    '(reserve_uuid);'
-  );
-END $$;
-
-
-CREATE FUNCTION reserves_out_by_reserve_insert_trigger()
-  RETURNS trigger
-  LANGUAGE plpgsql
-  AS $$
-BEGIN
-  INSERT INTO donau.reserves_out_by_reserve
-    (reserve_uuid
-    ,h_blind_ev)
-  VALUES
-    (NEW.reserve_uuid
-    ,NEW.h_blind_ev);
-  RETURN NEW;
-END $$;
-COMMENT ON FUNCTION reserves_out_by_reserve_insert_trigger()
-  IS 'Replicate reserve_out inserts into reserve_out_by_reserve table.';
-
-
-CREATE FUNCTION reserves_out_by_reserve_delete_trigger()
-  RETURNS trigger
-  LANGUAGE plpgsql
-  AS $$
-BEGIN
-  DELETE FROM donau.reserves_out_by_reserve
-   WHERE reserve_uuid = OLD.reserve_uuid;
-  RETURN OLD;
-END $$;
-COMMENT ON FUNCTION reserves_out_by_reserve_delete_trigger()
-  IS 'Replicate reserve_out deletions into reserve_out_by_reserve table.';
-
-
-CREATE FUNCTION master_table_reserves_out()
-RETURNS void
-LANGUAGE plpgsql
-AS $$
-BEGIN
-  CREATE TRIGGER reserves_out_on_insert
-  AFTER INSERT
-   ON reserves_out
-   FOR EACH ROW EXECUTE FUNCTION reserves_out_by_reserve_insert_trigger();
-  CREATE TRIGGER reserves_out_on_delete
-  AFTER DELETE
-    ON reserves_out
-   FOR EACH ROW EXECUTE FUNCTION reserves_out_by_reserve_delete_trigger();
-END $$;
-COMMENT ON FUNCTION master_table_reserves_out()
-  IS 'Setup triggers to replicate reserve_out into reserve_out_by_reserve.';
-
-
-INSERT INTO donau_tables
-    (name
-    ,version
-    ,action
-    ,partitioned
-    ,by_range)
-  VALUES
-    ('reserves_out'
-    ,'donau-0002'
-    ,'create'
-    ,TRUE
-    ,FALSE),
-    ('reserves_out'
-    ,'donau-0002'
-    ,'constrain'
-    ,TRUE
-    ,FALSE),
-    ('reserves_out'
-    ,'donau-0002'
-    ,'foreign'
-    ,TRUE
-    ,FALSE),
-    ('reserves_out_by_reserve'
-    ,'donau-0002'
-    ,'create'
-    ,TRUE
-    ,FALSE),
-    ('reserves_out_by_reserve'
-    ,'donau-0002'
-    ,'constrain'
-    ,TRUE
-    ,FALSE),
-    ('reserves_out'
-    ,'donau-0002'
-    ,'master'
-    ,TRUE
-    ,FALSE);
diff --git a/src/donaudb/0002-wad_in_entries.sql 
b/src/donaudb/0002-wad_in_entries.sql
deleted file mode 100644
index c023f20..0000000
--- a/src/donaudb/0002-wad_in_entries.sql
+++ /dev/null
@@ -1,185 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE FUNCTION create_table_wad_in_entries(
-  IN partition_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'wad_in_entries';
-BEGIN
-  PERFORM create_partitioned_table(
-    'CREATE TABLE %I '
-      '(wad_in_entry_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
-      ',wad_in_serial_id INT8'
-      ',reserve_pub BYTEA NOT NULL CHECK(LENGTH(reserve_pub)=32)'
-      ',purse_pub BYTEA PRIMARY KEY CHECK(LENGTH(purse_pub)=32)'
-      ',h_contract BYTEA NOT NULL CHECK(LENGTH(h_contract)=64)'
-      ',purse_expiration INT8 NOT NULL'
-      ',merge_timestamp INT8 NOT NULL'
-      ',amount_with_fee taler_amount NOT NULL'
-      ',wad_fee taler_amount NOT NULL'
-      ',deposit_fees taler_amount NOT NULL'
-      ',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)'
-      ',purse_sig BYTEA NOT NULL CHECK (LENGTH(purse_sig)=64)'
-    ') %s ;'
-    ,table_name
-    ,'PARTITION BY HASH (purse_pub)'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_table(
-     'list of purses aggregated in a wad according to the sending donau'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'wad for which the given purse was included in the aggregation'
-    ,'wad_in_serial_id'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'target account of the purse (must be at the local donau)'
-    ,'reserve_pub'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'public key of the purse that was merged'
-    ,'purse_pub'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-    'hash of the contract terms of the purse'
-    ,'h_contract'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Time when the purse was set to expire'
-    ,'purse_expiration'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Time when the merge was approved'
-    ,'merge_timestamp'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Total amount in the purse'
-    ,'amount_with_fee'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Total wad fees paid by the purse'
-    ,'wad_fee'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Total deposit fees paid when depositing coins into the purse'
-    ,'deposit_fees'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Signature by the receiving reserve, of purpose 
TALER_SIGNATURE_ACCOUNT_MERGE'
-    ,'reserve_sig'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Signature by the purse of purpose TALER_SIGNATURE_PURSE_MERGE'
-    ,'purse_sig'
-    ,table_name
-    ,partition_suffix
-  );
-END $$;
-
-
-CREATE FUNCTION constrain_table_wad_in_entries(
-  IN partition_suffix TEXT
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'wad_in_entries';
-BEGIN
-  table_name = concat_ws('_', table_name, partition_suffix);
-
-  -- FIXME: change to materialized index by reserve_pub!
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || '_reserve_pub '
-    'ON ' || table_name || ' '
-    '(reserve_pub);'
-  );
-  EXECUTE FORMAT (
-    'COMMENT ON INDEX ' || table_name || '_reserve_pub '
-    'IS ' || quote_literal('needed in reserve history computation') || ';'
-  );
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_wad_in_entry_serial_id_key'
-    ' UNIQUE (wad_in_entry_serial_id) '
-  );
-END $$;
-
-
-CREATE FUNCTION foreign_table_wad_in_entries()
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'wad_in_entries';
-BEGIN
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_foreign_wad_in'
-    ' FOREIGN KEY(wad_in_serial_id)'
-    ' REFERENCES wads_in (wad_in_serial_id) ON DELETE CASCADE'
-  );
-END $$;
-
-
-INSERT INTO donau_tables
-    (name
-    ,version
-    ,action
-    ,partitioned
-    ,by_range)
-  VALUES
-    ('wad_in_entries'
-    ,'donau-0002'
-    ,'create'
-    ,TRUE
-    ,FALSE),
-    ('wad_in_entries'
-    ,'donau-0002'
-    ,'constrain'
-    ,TRUE
-    ,FALSE),
-    ('wad_in_entries'
-    ,'donau-0002'
-    ,'foreign'
-    ,TRUE
-    ,FALSE);
diff --git a/src/donaudb/0002-wad_out_entries.sql 
b/src/donaudb/0002-wad_out_entries.sql
deleted file mode 100644
index 20d43a8..0000000
--- a/src/donaudb/0002-wad_out_entries.sql
+++ /dev/null
@@ -1,185 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-
-CREATE FUNCTION create_table_wad_out_entries(
-  IN partition_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'wad_out_entries';
-BEGIN
-  PERFORM create_partitioned_table(
-     'CREATE TABLE %I '
-     '(wad_out_entry_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
-     ',wad_out_serial_id INT8'
-     ',reserve_pub BYTEA NOT NULL CHECK(LENGTH(reserve_pub)=32)'
-     ',purse_pub BYTEA PRIMARY KEY CHECK(LENGTH(purse_pub)=32)'
-     ',h_contract BYTEA NOT NULL CHECK(LENGTH(h_contract)=64)'
-     ',purse_expiration INT8 NOT NULL'
-     ',merge_timestamp INT8 NOT NULL'
-     ',amount_with_fee taler_amount NOT NULL'
-     ',wad_fee taler_amount NOT NULL'
-     ',deposit_fees taler_amount NOT NULL'
-     ',reserve_sig BYTEA NOT NULL CHECK (LENGTH(reserve_sig)=64)'
-     ',purse_sig BYTEA NOT NULL CHECK (LENGTH(purse_sig)=64)'
-     ') %s ;'
-    ,table_name
-    ,'PARTITION BY HASH (purse_pub)'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_table(
-    'Purses combined into a wad'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Wad the purse was part of'
-    ,'wad_out_serial_id'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Target reserve for the purse'
-    ,'reserve_pub'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Public key of the purse'
-    ,'purse_pub'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Hash of the contract associated with the purse'
-    ,'h_contract'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Time when the purse expires'
-    ,'purse_expiration'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Time when the merge was approved'
-    ,'merge_timestamp'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Total amount in the purse'
-    ,'amount_with_fee'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-    'Wad fee charged to the purse'
-    ,'wad_fee'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Total deposit fees charged to the purse'
-    ,'deposit_fees'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Signature by the receiving reserve, of purpose 
TALER_SIGNATURE_ACCOUNT_MERGE'
-    ,'reserve_sig'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Signature by the purse of purpose TALER_SIGNATURE_PURSE_MERGE'
-    ,'purse_sig'
-    ,table_name
-    ,partition_suffix
-  );
-END
-$$;
-
-
-CREATE FUNCTION constrain_table_wad_out_entries(
-  IN partition_suffix TEXT
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'wad_out_entries';
-BEGIN
-  table_name = concat_ws('_', table_name, partition_suffix);
-
-  -- FIXME: change to materialized index by reserve_pub!
-  EXECUTE FORMAT (
-    'CREATE INDEX ' || table_name || '_by_reserve_pub '
-    'ON ' || table_name || ' '
-    '(reserve_pub);'
-  );
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_wad_out_entry_serial_id_key'
-    ' UNIQUE (wad_out_entry_serial_id) '
-  );
-END
-$$;
-
-
-CREATE FUNCTION foreign_table_wad_out_entries()
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'wad_out_entries';
-BEGIN
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_foreign_wad_out'
-    ' FOREIGN KEY(wad_out_serial_id)'
-    ' REFERENCES wads_out (wad_out_serial_id) ON DELETE CASCADE'
-  );
-END
-$$;
-
-
-INSERT INTO donau_tables
-    (name
-    ,version
-    ,action
-    ,partitioned
-    ,by_range)
-  VALUES
-    ('wad_out_entries'
-    ,'donau-0002'
-    ,'create'
-    ,TRUE
-    ,FALSE),
-    ('wad_out_entries'
-    ,'donau-0002'
-    ,'constrain'
-    ,TRUE
-    ,FALSE),
-    ('wad_out_entries'
-    ,'donau-0002'
-    ,'foreign'
-    ,TRUE
-    ,FALSE);
diff --git a/src/donaudb/0002-wads_in.sql b/src/donaudb/0002-wads_in.sql
deleted file mode 100644
index b45a1d2..0000000
--- a/src/donaudb/0002-wads_in.sql
+++ /dev/null
@@ -1,107 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE FUNCTION create_table_wads_in(
-  IN partition_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'wads_in';
-BEGIN
-  PERFORM create_partitioned_table(
-     'CREATE TABLE %I '
-     '(wad_in_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
-     ',wad_id BYTEA PRIMARY KEY CHECK (LENGTH(wad_id)=24)'
-     ',origin_donau_url TEXT NOT NULL'
-     ',amount taler_amount NOT NULL'
-     ',arrival_time INT8 NOT NULL'
-     ',UNIQUE (wad_id, origin_donau_url)'
-     ') %s ;'
-    ,table_name
-    ,'PARTITION BY HASH (wad_id)'
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_table(
-     'Incoming donau-to-donau wad wire transfers'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Unique identifier of the wad, part of the wire transfer subject'
-    ,'wad_id'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Base URL of the originating URL, also part of the wire transfer subject'
-    ,'origin_donau_url'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Actual amount that was received by our donau'
-    ,'amount'
-    ,table_name
-    ,partition_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Time when the wad was received'
-    ,'arrival_time'
-    ,table_name
-    ,partition_suffix
-  );
-END $$;
-
-
-CREATE FUNCTION constrain_table_wads_in(
-  IN partition_suffix TEXT
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'wads_in';
-BEGIN
-  table_name = concat_ws('_', table_name, partition_suffix);
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_wad_in_serial_id_key'
-    ' UNIQUE (wad_in_serial_id) '
-    ',ADD CONSTRAINT ' || table_name || '_wad_is_origin_donau_url_key'
-    ' UNIQUE (wad_id, origin_donau_url) '
-  );
-END $$;
-
-
-INSERT INTO donau_tables
-    (name
-    ,version
-    ,action
-    ,partitioned
-    ,by_range)
-  VALUES
-    ('wads_in'
-    ,'donau-0002'
-    ,'create'
-    ,TRUE
-    ,FALSE),
-    ('wads_in'
-    ,'donau-0002'
-    ,'constrain'
-    ,TRUE
-    ,FALSE);
diff --git a/src/donaudb/0002-wads_out.sql b/src/donaudb/0002-wads_out.sql
deleted file mode 100644
index a69546d..0000000
--- a/src/donaudb/0002-wads_out.sql
+++ /dev/null
@@ -1,128 +0,0 @@
---
--- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
---
--- TALER is free software; you can redistribute it and/or modify it under the
--- terms of the GNU General Public License as published by the Free Software
--- Foundation; either version 3, or (at your option) any later version.
---
--- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
--- WARRANTY; without even the implied warranty of CHARITYABILITY or FITNESS FOR
--- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License along with
--- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
---
-
-CREATE FUNCTION create_table_wads_out(
-  IN shard_suffix TEXT DEFAULT NULL
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'wads_out';
-BEGIN
-  PERFORM create_partitioned_table(
-    'CREATE TABLE %I '
-      '(wad_out_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY'
-      ',wad_id BYTEA PRIMARY KEY CHECK (LENGTH(wad_id)=24)'
-      ',partner_serial_id INT8 NOT NULL'
-      ',amount taler_amount NOT NULL'
-      ',execution_time INT8 NOT NULL'
-    ') %s ;'
-    ,table_name
-    ,'PARTITION BY HASH (wad_id)'
-    ,shard_suffix
-  );
-  PERFORM comment_partitioned_table(
-     'Wire transfers made to another donau to transfer purse funds'
-    ,table_name
-    ,shard_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Unique identifier of the wad, part of the wire transfer subject'
-    ,'wad_id'
-    ,table_name
-    ,shard_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'target donau of the wad'
-    ,'partner_serial_id'
-    ,table_name
-    ,shard_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Amount that was wired'
-    ,'amount'
-    ,table_name
-    ,shard_suffix
-  );
-  PERFORM comment_partitioned_column(
-     'Time when the wire transfer was scheduled'
-    ,'execution_time'
-    ,table_name
-    ,shard_suffix
-  );
-END
-$$;
-
-
-CREATE FUNCTION constrain_table_wads_out(
-  IN partition_suffix TEXT
-)
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'wads_out';
-BEGIN
-  table_name = concat_ws('_', table_name, partition_suffix);
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_wad_out_serial_id_key'
-    ' UNIQUE (wad_out_serial_id) '
-  );
-END
-$$;
-
-
-CREATE FUNCTION foreign_table_wads_out()
-RETURNS VOID
-LANGUAGE plpgsql
-AS $$
-DECLARE
-  table_name TEXT DEFAULT 'wads_out';
-BEGIN
-  EXECUTE FORMAT (
-    'ALTER TABLE ' || table_name ||
-    ' ADD CONSTRAINT ' || table_name || '_foreign_partner'
-    ' FOREIGN KEY(partner_serial_id)'
-    ' REFERENCES partners(partner_serial_id) ON DELETE CASCADE'
-  );
-END
-$$;
-
-
-INSERT INTO donau_tables
-    (name
-    ,version
-    ,action
-    ,partitioned
-    ,by_range)
-  VALUES
-    ('wads_out'
-    ,'donau-0002'
-    ,'create'
-    ,TRUE
-    ,FALSE),
-    ('wads_out'
-    ,'donau-0002'
-    ,'constrain'
-    ,TRUE
-    ,FALSE),
-    ('wads_out'
-    ,'donau-0002'
-    ,'foreign'
-    ,TRUE
-    ,FALSE);

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