This commit is contained in:
2025-11-02 16:21:22 +01:00
parent ace5f22f93
commit 5cdf802bba
4 changed files with 58 additions and 8 deletions

View File

@@ -348,6 +348,7 @@ create schema bank;
-- Générateur de numéro aléatoire
-- ----------------------------------------------------------------------
/*
CREATE OR REPLACE FUNCTION bank.rand_account(n integer)
RETURNS text AS $$
DECLARE
@@ -369,9 +370,10 @@ BEGIN
RETURN out;
END;
$$ LANGUAGE plpgsql;
*/
-- Devises (Currencies)
-- ----------------------------------------------------------------------
/*
create table bank.currency (
code text not null,
num4217 integer default null,
@@ -416,9 +418,11 @@ alter table only pays_devises
alter table only pays_devises
add foreign key (devise_code)
references bank.currency (code);
*/
-- Taux de change ()
-- ----------------------------------------------------------------------
/*
CREATE TABLE bank.exchange_rate (
from_currency CHAR(3) references bank.currency(code),
to_currency CHAR(3) references bank.currency(code),
@@ -467,11 +471,13 @@ BEGIN
END $$;
DROP table exchange;
*/
-- ----------------------------------------------------------------------
-- Titulaires (Holders)
-- ----------------------------------------------------------------------
/*
CREATE TABLE bank.holder (
id bigint primary key generated always as identity,
type_titulaire TEXT CHECK (type_titulaire IN ('individu', 'société')) NOT NULL,
@@ -515,11 +521,13 @@ CREATE TRIGGER trg_auto_titulaire_morale
BEFORE INSERT ON societe
FOR EACH ROW
EXECUTE FUNCTION auto_titulaire_morale();
*/
-- ----------------------------------------------------------------------
-- Comptes (Accounts)
-- ----------------------------------------------------------------------
/*
create table bank.account (
id bigint primary key generated always as identity,
account_number text unique not null,
@@ -576,10 +584,11 @@ BEGIN
END LOOP;
END;
$$ LANGUAGE plpgsql;
*/
-- Transactions
-- ----------------------------------------------------------------------
/*
CREATE TABLE bank."transaction" (
id UUID PRIMARY KEY DEFAULT uuidv7(),
reference TEXT,
@@ -705,7 +714,7 @@ CREATE TRIGGER tr_notify_transaction
AFTER INSERT ON bank.transaction
FOR EACH ROW
EXECUTE FUNCTION notify_transaction();
*/
-- ----------------------------------------------------------------------
-- Business Intelligence
-- ----------------------------------------------------------------------

View File

@@ -16,6 +16,7 @@ truncate table fournisseur;
\COPY fournisseur FROM '/tmp/fournisseur.csv' (FORMAT CSV, header, ENCODING 'UTF8');
\COPY produit FROM '/tmp/produits/cereales_petitdejeuner.csv' (FORMAT CSV, header, ENCODING 'UTF8');
/*
\COPY personne(prenom, nom, telephone, ville) FROM '/tmp/personne1.csv' (FORMAT CSV, header, ENCODING 'UTF8');
\COPY societe(societe) FROM '/tmp/societe1.csv' (FORMAT CSV, header, ENCODING 'UTF8');
@@ -25,3 +26,4 @@ SELECT bank.insert_account_random(ARRAY[3]);
SELECT bank.insert_account_random(ARRAY[4]);
SELECT bank.insert_account_random(ARRAY[5],'USD');
SELECT bank.insert_account_random(ARRAY[6,11]);
*/