Mise à jour des taux
This commit is contained in:
16
01_bank.sql
16
01_bank.sql
@@ -1,15 +1,15 @@
|
||||
show server_version;
|
||||
--show server_version;
|
||||
|
||||
-- ----------------------------------------------------------------------
|
||||
-- extensions
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
select * from pg_available_extensions;
|
||||
--select * from pg_available_extensions;
|
||||
|
||||
SHOW shared_preload_libraries;
|
||||
--show shared_preload_libraries;
|
||||
|
||||
drop schema if exists public cascade;
|
||||
create schema public;
|
||||
--drop schema if exists public cascade;
|
||||
--create schema public;
|
||||
|
||||
create schema if not exists ext;
|
||||
create extension if not exists pgcrypto schema ext;
|
||||
@@ -364,7 +364,7 @@ $$;
|
||||
|
||||
call add_company('Boulangerie de Valorgue', 'FR19803269968', '2014-08-19');
|
||||
|
||||
create or replace procedure add_account(
|
||||
create or replace procedure add_account (
|
||||
p_currency text,
|
||||
p_holders int[],
|
||||
p_shares numeric[]
|
||||
@@ -456,6 +456,8 @@ begin
|
||||
insert into operation (transaction_id, account_id, amount, direction)
|
||||
values (v_id, p_account_id, p_amount, 'CREDIT');
|
||||
|
||||
update account set balance = balance + p_amount where id = p_account_id;
|
||||
|
||||
raise notice 'Dépôt de % sur le compte %', p_amount, p_account_id;
|
||||
end;
|
||||
$$;
|
||||
@@ -476,6 +478,8 @@ begin
|
||||
insert into operation (transaction_id, account_id, amount, direction)
|
||||
values (v_id, p_account_id, p_amount, 'DEBIT');
|
||||
|
||||
update account set balance = balance - p_amount where id = p_account_id;
|
||||
|
||||
raise notice 'Retrait de % sur le compte %', p_amount, p_account_id;
|
||||
end;
|
||||
$$;
|
||||
|
||||
Reference in New Issue
Block a user