diff --git a/KLHZ.Trader.Infrastructure/postgres/migration3.sql b/KLHZ.Trader.Infrastructure/postgres/migration3.sql index 52606f7..e5c2e44 100644 --- a/KLHZ.Trader.Infrastructure/postgres/migration3.sql +++ b/KLHZ.Trader.Infrastructure/postgres/migration3.sql @@ -1,12 +1,14 @@ -drop table if exists instrument_trades; -create table instrument_trades +drop table if exists orderbook_items; +create table orderbook_items ( - trade_id bigserial, - bought_at timestamp default current_timestamp, + id bigserial, + time timestamp default current_timestamp, figi text not null, ticker text not null, price decimal not null, - count decimal not null, - direction int not null default 1, - primary key (trade_id) -); \ No newline at end of file + count bigint not null, + item_type int not null default 1, + primary key (id) +); + +CREATE INDEX orderbook_items_index ON orderbook_items USING btree(figi, time, item_type); \ No newline at end of file