Files
ems/db/migration/V013__predicted_negative_price_window.sql
Dusan Vojacek 9f4126946d second version
2026-04-03 14:23:16 +02:00

21 lines
887 B
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- Predikovaná okna záporných spotových cen (cache pro UI / API)
CREATE TABLE ems.predicted_negative_price_window (
id SERIAL PRIMARY KEY,
site_id INT NOT NULL REFERENCES ems.site (id),
predicted_at TIMESTAMPTZ NOT NULL DEFAULT now(),
predicted_date DATE NOT NULL,
window_start_hour INT NOT NULL,
window_end_hour INT NOT NULL,
probability_pct INT NOT NULL,
expected_min_price NUMERIC(10, 4),
reason TEXT,
UNIQUE (site_id, predicted_date, window_start_hour)
);
COMMENT ON TABLE ems.predicted_negative_price_window IS
'Výstup ems.fn_predict_negative_price_windows predikce intervalů s rizikem záporné nákupní ceny; obnovovat po importu cen a forecastu FVE.';
CREATE INDEX idx_predicted_neg_price_site_date
ON ems.predicted_negative_price_window (site_id, predicted_date);