feat: Add street address to locations

Adds a street_address column to the locations table and updates the LocationSearch component to capture, store, and display full street addresses. This includes database migration, interface updates, and formatter logic.
This commit is contained in:
gpt-engineer-app[bot]
2025-11-06 13:51:40 +00:00
parent c1683f9b02
commit 98fbc94476
5 changed files with 128 additions and 9 deletions

View File

@@ -0,0 +1,19 @@
-- 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;