taldir

Directory service to resolve wallet mailboxes by messenger addresses
Log | Files | Refs | Submodules | README | LICENSE

taler-directory-0001.sql (2228B)


      1 --
      2 -- This file is part of TALER
      3 -- Copyright (C) 2026 Taler Systems SA
      4 --
      5 -- TALER is free software; you can redistribute it and/or modify it under the
      6 -- terms of the GNU General Public License as published by the Free Software
      7 -- Foundation; either version 3, or (at your option) any later version.
      8 --
      9 -- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     10 -- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11 -- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     12 --
     13 -- You should have received a copy of the GNU General Public License along with
     14 -- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 --
     16 
     17 -- @file taler-directory-0001.sql
     18 -- @brief database schema for TalDir
     19 -- @author Christian Grothoff
     20 -- @author Martin Schanzenbach
     21 
     22 -- Everything in one big transaction
     23 BEGIN;
     24 
     25 -- Check patch versioning is in place.
     26 SELECT _v.register_patch('taler-directory-0001', NULL, NULL);
     27 
     28 CREATE SCHEMA taler_directory;
     29 COMMENT ON SCHEMA taler_directory IS 'taler-directory data';
     30 
     31 SET search_path TO taler_directory;
     32 
     33 ---------------- Entries ---------------------------
     34 
     35 CREATE TABLE IF NOT EXISTS entries
     36   (entry_serial BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY
     37   ,hs_alias BYTEA NOT NULL
     38   ,created_at INT8 NOT NULL
     39   ,target_uri BYTEA NOT NULL 
     40   ,duration INT8 NOT NULL
     41   ,UNIQUE (hs_alias)
     42   );
     43 COMMENT ON TABLE entries
     44  IS 'An entry in the directory';
     45 COMMENT ON COLUMN entries.hs_alias
     46  IS 'The salted and hashed alias';
     47 
     48 ---------------- Validations ---------------------------
     49 
     50 CREATE TABLE IF NOT EXISTS validations
     51   (validation_serial BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY
     52   ,created_at INT8 NOT NULL
     53   ,h_alias BYTEA NOT NULL
     54   ,duration INT8 NOT NULL
     55   ,target_uri BYTEA NOT NULL
     56   ,challenge BYTEA NOT NULL
     57   ,challenge_sent BOOLEAN NOT NULL
     58   ,requires_payment BOOLEAN NOT NULL
     59   ,solution_attempt_count INT NOT NULL
     60   ,last_solution_timeframe_start INT8 NOT NULL
     61   ,order_id BYTEA
     62   ,validator_name BYTEA NOT NULL
     63   );
     64 COMMENT ON TABLE validations
     65  IS 'A pending validation in the directory';
     66 COMMENT ON COLUMN validations.h_alias
     67  IS 'The hashed alias';
     68 
     69 
     70 -- Complete transaction
     71 COMMIT;