20 lines
874 B
SQL
20 lines
874 B
SQL
-- Seyahat başlangıç noktası alanlarını ekle
|
||
ALTER TABLE trips
|
||
ADD COLUMN IF NOT EXISTS start_location_name TEXT,
|
||
ADD COLUMN IF NOT EXISTS start_lat DOUBLE PRECISION,
|
||
ADD COLUMN IF NOT EXISTS start_lng DOUBLE PRECISION;
|
||
|
||
-- start_location_type için CHECK constraint güncelle (eğer yoksa ekle)
|
||
DO $$
|
||
BEGIN
|
||
-- Önce mevcut constraint'i kaldır (varsa)
|
||
ALTER TABLE trips DROP CONSTRAINT IF EXISTS trips_start_location_type_check;
|
||
|
||
-- Yeni constraint ekle
|
||
ALTER TABLE trips ADD CONSTRAINT trips_start_location_type_check
|
||
CHECK (start_location_type IN ('balloon', 'hotel', 'custom', 'place', 'city_center'));
|
||
END $$;
|
||
|
||
COMMENT ON COLUMN trips.start_location_name IS 'Başlangıç noktası adı (otel adı, adres vb.)';
|
||
COMMENT ON COLUMN trips.start_lat IS 'Başlangıç noktası enlem';
|
||
COMMENT ON COLUMN trips.start_lng IS 'Başlangıç noktası boylam'; |