accountant-ui/sql/update/0.2-0.3/001_scheduled_operations.sql

17 lines
547 B
MySQL
Raw Normal View History

create table scheduled_operation(
id serial primary key,
start_date date not null,
stop_date date not null,
day integer not null check (day > 0 and day <= 31),
frequency integer not null check (frequency > 0),
label varchar(500) not null,
value numeric(15,2) not null,
account_id integer not null references account(id),
category varchar(100)
);
create index scheduled_operation_account_id_idx on scheduled_operation(account_id);
alter table entry add column scheduled_operation_id integer references scheduled_operation(id);