33 lines
1.3 KiB
SQL
33 lines
1.3 KiB
SQL
create table if not exists decision_assistant_preferences (
|
|
id bigserial primary key,
|
|
profile_key varchar(64) not null,
|
|
instrument_id bigint not null,
|
|
digest_mode varchar(32) not null default 'all_reminders',
|
|
preferred_history_kind varchar(64),
|
|
importance_threshold integer not null default 70,
|
|
payload jsonb not null default '{}'::jsonb,
|
|
updated_ts timestamptz not null default now(),
|
|
unique (profile_key, instrument_id)
|
|
);
|
|
|
|
create index if not exists idx_decision_assistant_preferences_instrument
|
|
on decision_assistant_preferences (instrument_id, updated_ts desc);
|
|
|
|
create table if not exists decision_assistant_digest_history (
|
|
id bigserial primary key,
|
|
profile_key varchar(64) not null default 'local_operator',
|
|
instrument_id bigint not null,
|
|
digest_mode varchar(32) not null default 'all_reminders',
|
|
preferred_history_kind varchar(64),
|
|
top_summary text,
|
|
snapshot_signature varchar(128) not null,
|
|
payload jsonb not null default '{}'::jsonb,
|
|
created_ts timestamptz not null default now()
|
|
);
|
|
|
|
create index if not exists idx_decision_assistant_digest_history_instrument_ts
|
|
on decision_assistant_digest_history (instrument_id, created_ts desc);
|
|
|
|
create index if not exists idx_decision_assistant_digest_history_signature
|
|
on decision_assistant_digest_history (instrument_id, snapshot_signature);
|