View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0009431 | Taler | libeufin (general) | public | 2024-12-30 18:17 | 2025-01-06 11:45 |
Reporter | Antoine A | Assigned To | Antoine A | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Target Version | 1.0 | ||||
Summary | 0009431: Simplify incoming talerable transactions schema | ||||
Description | The current SQL schema for incoming talerable transactions for both libeufin-bank and libeufin-nexus is like: ```sql CREATE TYPE incoming_type AS ENUM('reserve' ,'kyc', 'wad'); CREATE TABLE taler_in( type incoming_type NOT NULL, reserve_pub BYTEA UNIQUE CHECK (LENGTH(reserve_pub)=32), account_pub BYTEA CHECK (LENGTH(account_pub)=32), wad_id BYTEA CHECK (LENGTH(wad_id)=24), origin_exchange_url TEXT, CONSTRAINT polymorphism CHECK( CASE type WHEN 'reserve' THEN reserve_pub IS NOT NULL AND account_pub IS NULL AND origin_exchange_url IS NULL AND wad_id IS NULL WHEN 'kyc' THEN reserve_pub IS NULL AND account_pub IS NOT NULL AND origin_exchange_url IS NULL AND wad_id IS NULL WHEN 'wad' THEN reserve_pub IS NULL AND account_pub IS NULL AND origin_exchange_url IS NOT NULL AND wad_id IS NOT NULL END ) ); ``` While writing the magnet bank schema from scratch I found we can simply this to: ```sql CREATE TABLE taler_in( type incoming_type NOT NULL, metadata BYTEA NOT NULL, origin_exchange_url TEXT, CONSTRAINT polymorphism CHECK( CASE type WHEN 'wad' THEN LENGTH(metadata)=24 AND origin_exchange_url IS NOT NULL ELSE LENGTH(metadata)=32 AND origin_exchange_url IS NULL END ) ); CREATE UNIQUE INDEX taler_in_unique_reserve_pub ON taler_in (metadata) WHERE type = 'reserve'; ``` This reduces the number of columns and simplifies SQL code and logic, while applying the same constraints. | ||||
Tags | No tags attached. | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2024-12-30 18:17 | Antoine A | New Issue | |
2024-12-30 18:17 | Antoine A | Status | new => assigned |
2024-12-30 18:17 | Antoine A | Assigned To | => Antoine A |
2025-01-06 11:45 | Antoine A | Status | assigned => resolved |
2025-01-06 11:45 | Antoine A | Resolution | open => fixed |
2025-01-06 11:45 | Antoine A | Note Added: 0023939 |