32 lines
1018 B
SQL
32 lines
1018 B
SQL
drop table if exists finance.transactions cascade;
|
|
|
|
create table finance.transactions
|
|
(
|
|
|
|
id integer generated by default as identity not null,
|
|
space_id integer
|
|
constraint fk_transactions_on_space
|
|
references spaces,
|
|
parent_id integer
|
|
constraint fk_transactions_on_parent
|
|
references transactions,
|
|
type varchar(255),
|
|
kind varchar(255),
|
|
category_id integer,
|
|
comment varchar(255),
|
|
amount numeric,
|
|
fees numeric,
|
|
date date,
|
|
is_done boolean not null,
|
|
is_deleted boolean not null,
|
|
created_by_id integer
|
|
constraint fk_transactions_on_createdby
|
|
references users,
|
|
created_at timestamp default now(),
|
|
updated_by_id integer
|
|
constraint fk_transactions_on_updatedby
|
|
references users,
|
|
updated_at timestamp default now(),
|
|
|
|
CONSTRAINT pk_transactions PRIMARY KEY (id)
|
|
); |