 REFERENCES hzrdi.parsed_source(id)
 ON DELETE CASCADE;
 
+-- idata.hazard_curve_progress to idata.lt_realization FK
+ALTER TABLE idata.hazard_curve_progress
+ADD CONSTRAINT idata_hazard_curve_progress_lt_realization_fk
+FOREIGN KEY (lt_realization_id)
+REFERENCES idata.lt_realization(id)
+ON DELETE CASCADE;
+
 -- idata.site_data to uiapi.hazard_calculation FK
 ALTER TABLE idata.site_data
 ADD CONSTRAINT idata_site_data_hazard_calculation_fk

CREATE TABLE idata.lt_realization (
    id SERIAL PRIMARY KEY,
    hazard_calculation_id INTEGER NOT NULL,
    -- optional FK; if null, get reference site parameters from hazard_calculation
    site_data_id INTEGER,
    ordinal INTEGER NOT NULL,
    sm_lt_path VARCHAR NOT NULL,
    gsim_lt_path VARCHAR NOT NULL,

    -- This table will contain 1 record per IMT per logic tree realization
    -- for a given calculation.
    id SERIAL PRIMARY KEY,
    lt_realization_id INTEGER NOT NULL,
    imt VARCHAR NOT NULL,
    -- stores a pickled numpy array for intermediate results
    -- array is 2d: sites x IMLs
