location_postal needs to accept NULL

Created on 13 June 2024, 7 months ago
Updated 28 June 2024, 6 months ago

Hi. It is so great to see this module develop.

If you try and run drush visitors:rebuild:location after someone visits your site from a country without postal codes, an error occurs.

 SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'location_postal' cannot be null: UPDATE "visitors" SET "location_continent_code"=:db_update_placeholder_0  
  , "location_country_code"=:db_update_placeholder_1, "location_country_name"=:db_update_placeholder_2, "location_region"=:db_update_placeholder_3, "location_city"=:db_u  
  pdate_placeholder_4, "location_postal"=:db_update_placeholder_5, "location_latitude"=:db_update_placeholder_6, "location_longitude"=:db_update_placeholder_7, "location  
  _area_code"=:db_update_placeholder_8                                                                                                                                     
  WHERE ("visitors_ip" = :db_condition_placeholder_0) AND ("location_latitude" IS NULL); Array                                                                             
  (                                                                                                                                                                        
      [:db_update_placeholder_0] => EU                                                                                                                                     
      [:db_update_placeholder_1] => BA                                                                                                                                     
      [:db_update_placeholder_2] => Bosnia and Herzegovina                                                                                                                 
      [:db_update_placeholder_3] => BIH                                                                                                                                    
      [:db_update_placeholder_4] => Novi Travnik                                                                                                                           
      [:db_update_placeholder_5] =>                                                                                                                                        
      [:db_update_placeholder_6] => 44.1678                                                                                                                                
      [:db_update_placeholder_7] => 17.6563                                                                                                                                
      [:db_update_placeholder_8] =>                                                                                                                                        
      [:db_condition_placeholder_0] => 185.99.3.203                                                                                                                        
  ) 

The attached patch seems to fix that.

🐛 Bug report
Status

Fixed

Version

2.19

Component

Code

Created by

🇺🇸United States duckydan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024