-- Add street_address column to locations table
ALTER TABLE locations 
ADD COLUMN street_address TEXT;

-- Add comment explaining the column
COMMENT ON COLUMN locations.street_address IS 'Street address including house number and road name (e.g., "375 North Lagoon Drive")';

-- Add index for potential searches
CREATE INDEX idx_locations_street_address ON locations(street_address);

-- Update existing records: extract from name if it looks like an address
-- (This is best-effort cleanup for existing data)
UPDATE locations 
SET street_address = CASE 
  WHEN name ~ '^\d+\s+.*' THEN 
    regexp_replace(name, ',.*$', '')  -- Extract everything before first comma
  ELSE NULL 
END
WHERE street_address IS NULL;