Files
thrilltrack-explorer/supabase/migrations/20251106135032_5a298052-a29e-4c65-a672-e278ac2e8560.sql
gpt-engineer-app[bot] 98fbc94476 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.
2025-11-06 13:51:40 +00:00

19 lines
712 B
SQL

-- 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;