This commit is contained in:
2025-11-28 13:40:57 +01:00
parent 3c22c2a4d4
commit 43711734f0
2 changed files with 33 additions and 8 deletions

View File

@@ -8,21 +8,23 @@
--show shared_preload_libraries;
--drop schema if exists public cascade;
--create schema public;
create schema if not exists ext;
create extension if not exists pgcrypto schema ext;
create extension if not exists tablefunc;
create extension if not exists pg_cron;
create extension if not exists timescaledb;
--drop schema if exists public cascade;
--create schema public;
create type holder_type as enum ('BANK', 'PERSON', 'COMPANY');
create table holder (
"id" bigint primary key generated always as identity,
"type" holder_type not null,
"created_at" timestamp not null default current_timestamp
"created_at" timestamptz not null default current_timestamp
);
/************************************************************************
@@ -278,7 +280,7 @@ create table account_holder (
create table transaction (
"id" bigint primary key generated always as identity,
"transaction_date" timestamp not null default current_timestamp,
"transaction_date" timestamptz not null default current_timestamp,
amount decimal not null check (amount > 0)
);
@@ -421,9 +423,9 @@ call add_account('EUR', array[1], array[1]);
call add_account('USD', array[1], array[1]);
call add_account('JPY', array[1], array[1]);
update account set balance = 100000 where id = 1;
update account set balance = 50000 where id = 2;
update account set balance = 2000000 where id = 3;
update account set balance = 100 where id = 1;
update account set balance = 500 where id = 2;
update account set balance = 200 where id = 3;
call add_account('EUR', array[2, 3], array[0.6, 0.4]);