38980-vm/app-9w9pd00g5j41/supabase/migrations/00005_add_trip_interests.sql
2026-03-04 18:25:09 +00:00

25 lines
1.2 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Trips tablosuna interests alanı ekle
ALTER TABLE trips ADD COLUMN IF NOT EXISTS interests TEXT[];
-- Places tablosuna tags alanı ekle (ilgi alanlarıyla eşleştirme için)
ALTER TABLE places ADD COLUMN IF NOT EXISTS tags TEXT[];
-- Mevcut yerlere tags ekle (type'a göre)
UPDATE places SET tags = ARRAY['Tarih ve Kültür'] WHERE type IN ('Müze', 'Tarihi Yer');
UPDATE places SET tags = ARRAY['Doğa ve Yürüyüş'] WHERE type IN ('Park', 'Doğal Oluşum');
UPDATE places SET tags = ARRAY['Aktivite/Macera'] WHERE type = 'Aktivite';
UPDATE places SET tags = ARRAY['Gastronomi'] WHERE type = 'Restoran';
-- Sıcak Hava Balonu için özel güncelleme
UPDATE places SET tags = ARRAY['Sıcak Hava Balonu', 'Aktivite/Macera', 'Fotoğraf Çekimi']
WHERE name LIKE '%Balon%' OR name LIKE '%Balloon%';
-- Kapadokya yerlerine Fotoğraf Çekimi tag'i ekle
UPDATE places SET tags = array_append(tags, 'Fotoğraf Çekimi')
WHERE (city = 'Göreme' OR city = 'Ürgüp' OR city = 'Uçhisar')
AND NOT ('Fotoğraf Çekimi' = ANY(tags));
-- Index oluştur
CREATE INDEX IF NOT EXISTS idx_places_tags ON places USING GIN(tags);
CREATE INDEX IF NOT EXISTS idx_trips_interests ON trips USING GIN(interests);