Files
ai-exchange/migrations/029_add_market_truth_runtime_fields.sql
T
2026-05-07 00:12:12 +08:00

22 lines
852 B
SQL

alter table if exists market_states
add column if not exists stream_state jsonb not null default '{}'::jsonb,
add column if not exists data_gap_state jsonb not null default '{}'::jsonb;
create table if not exists market_truth_incidents (
id bigserial primary key,
instrument_id bigint references instruments(id),
timeframe text,
incident_type text not null,
incident_code text not null,
status text not null,
observed_ts timestamptz not null,
details jsonb not null default '{}'::jsonb,
created_at timestamptz not null default now()
);
create index if not exists idx_market_truth_incidents_instr_observed_desc
on market_truth_incidents (instrument_id, observed_ts desc);
create index if not exists idx_market_truth_incidents_code_observed_desc
on market_truth_incidents (incident_code, observed_ts desc);