| 2 | |
| 3 | == DLL код |
| 4 | |
| 5 | {{{ |
| 6 | create table account( |
| 7 | id serial primary key, |
| 8 | username varchar(255) not null, |
| 9 | password varchar(255) not null, |
| 10 | balance decimal(15, 2) not null |
| 11 | ); |
| 12 | |
| 13 | create table "transaction"( |
| 14 | id serial primary key, |
| 15 | amount decimal(15, 2) not null, |
| 16 | type varchar(50) not null, |
| 17 | timestamp timestamp default current_timestamp, |
| 18 | account_id int not null, |
| 19 | foreign key (account_id) references account(id) |
| 20 | ); |
| 21 | |
| 22 | create table deposit( |
| 23 | id serial primary key, |
| 24 | account_id int not null, |
| 25 | amount decimal(15,2) not null, |
| 26 | timestamp timestamp default current_timestamp, |
| 27 | foreign key(account_id) references account(id) |
| 28 | ); |
| 29 | |
| 30 | create table withdraw( |
| 31 | id serial primary key, |
| 32 | account_id int not null, |
| 33 | amount decimal(15,2) not null, |
| 34 | timestamp timestamp default current_timestamp, |
| 35 | foreign key(account_id) references account(id) |
| 36 | ); |
| 37 | |
| 38 | create table transferred_money( |
| 39 | id serial primary key, |
| 40 | s_account_id int not null, |
| 41 | r_account_id int not null, |
| 42 | t_id int not null, |
| 43 | currency varchar(50) not null, |
| 44 | foreign key (s_account_id) references account(id), |
| 45 | foreign key (r_account_id) references account(id), |
| 46 | foreign key (t_id) references transaction(id) |
| 47 | ); |
| 48 | |
| 49 | |
| 50 | }}} |