-- Recreates the legacy task_tasktemplate_regions join table. Data is not -- restored — if a rollback needs the prior associations they have to be -- reseeded from the task template conditions JSON. CREATE TABLE IF NOT EXISTS task_tasktemplate_regions ( task_template_id BIGINT NOT NULL, climate_region_id BIGINT NOT NULL, PRIMARY KEY (task_template_id, climate_region_id) ); CREATE INDEX IF NOT EXISTS idx_task_tasktemplate_regions_region ON task_tasktemplate_regions (climate_region_id);