create table if not exists execution_tickets ( id bigserial primary key, signal_id bigint not null references trade_signals(id), execution_mode text not null, status text not null, created_ts timestamptz not null, expires_ts timestamptz, confirmed_by text, confirmed_at timestamptz, execution_id bigint references trade_executions(id), ticket_snapshot 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_execution_tickets_signal_created_desc on execution_tickets (signal_id, created_ts desc); create index if not exists idx_execution_tickets_status_created_desc on execution_tickets (status, created_ts desc); create index if not exists idx_execution_tickets_execution_id on execution_tickets (execution_id);