31ece2e99a
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22 lines
854 B
SQL
22 lines
854 B
SQL
create table if not exists structure_events (
|
|
id bigserial primary key,
|
|
instrument_id bigint not null references instruments(id),
|
|
timeframe text not null,
|
|
event_type text not null,
|
|
direction text not null,
|
|
broken_level numeric(20,10) not null,
|
|
reference_swing_id bigint references swings(id),
|
|
displacement_event_id bigint references displacement_events(id),
|
|
accepted boolean,
|
|
signal_relevant boolean not null default true,
|
|
ts timestamptz not null,
|
|
meta jsonb not null default '{}'::jsonb,
|
|
created_at timestamptz not null default now()
|
|
);
|
|
|
|
create index if not exists idx_structure_events_instr_tf_ts_desc
|
|
on structure_events (instrument_id, timeframe, ts desc);
|
|
|
|
create index if not exists idx_structure_events_instr_tf_event_ts_desc
|
|
on structure_events (instrument_id, timeframe, event_type, ts desc);
|