-- =============================================================================
-- fix_mystateconnews_submit_all_states.sql — every state and territory can be
-- chosen on the "Submit a Notice" form (13 Nov 2026: every state is live).
--
-- Replaces the State field's single "South Carolina — Open" option with all
-- 56 states and territories (A-Z). Only touches the field while it still has
-- that original single option, so an edit made in Aggie is kept. Idempotent.
-- =============================================================================
SET NAMES utf8mb4;
SET @site_id := (SELECT id FROM dim_web_sites WHERE public_site_key = 'YPIYmVgmODxVTxgcSNwb1yAKdCtFe1M9kGT5YnTxEkL3xxs9' LIMIT 1);

UPDATE dim_web_form_fields ff
JOIN dim_web_forms f ON f.id = ff.form_id
SET ff.config_json = '{"options":["Alabama","Alaska","American Samoa","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Guam","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Northern Mariana Islands","Ohio","Oklahoma","Oregon","Pennsylvania","Puerto Rico","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","U.S. Virgin Islands","Utah","Vermont","Virginia","Washington","Washington D.C.","West Virginia","Wisconsin","Wyoming"]}'
WHERE f.site_id = @site_id AND f.form_key = 'con-notice-submission' AND ff.field_key = 'state'
  AND CONVERT(ff.config_json USING utf8mb4) = CONVERT('{"options":["South Carolina — Open"]}' USING utf8mb4);
