30 lines
1.2 KiB
SQL
30 lines
1.2 KiB
SQL
create table if not exists live_operation_audits (
|
|
id bigserial primary key,
|
|
adapter_name text not null,
|
|
operation_type text not null,
|
|
status text not null,
|
|
execution_ticket_id bigint references execution_tickets(id),
|
|
execution_id bigint references trade_executions(id),
|
|
signal_id bigint references trade_signals(id),
|
|
instrument_id bigint references instruments(id),
|
|
requested_by text,
|
|
requested_at timestamptz not null,
|
|
completed_at timestamptz,
|
|
live_trading_enabled boolean not null default false,
|
|
explicit_confirmation boolean not null default false,
|
|
payload jsonb not null default '{}'::jsonb,
|
|
result jsonb not null default '{}'::jsonb,
|
|
reason_codes jsonb not null default '[]'::jsonb,
|
|
created_at timestamptz not null default now(),
|
|
updated_at timestamptz not null default now()
|
|
);
|
|
|
|
create index if not exists idx_live_operation_audits_requested_desc
|
|
on live_operation_audits (requested_at desc);
|
|
|
|
create index if not exists idx_live_operation_audits_ticket_requested_desc
|
|
on live_operation_audits (execution_ticket_id, requested_at desc);
|
|
|
|
create index if not exists idx_live_operation_audits_execution_requested_desc
|
|
on live_operation_audits (execution_id, requested_at desc);
|