-- Remove old non-RU channels FIRST (before changing constraint)
DELETE FROM channels WHERE name IN ('airbnb', 'expedia', 'vrbo');

-- Now safely replace constraint
ALTER TABLE channels DROP CONSTRAINT IF EXISTS channels_name_check;
ALTER TABLE channels ADD CONSTRAINT channels_name_check
  CHECK (name IN (
    'booking_com',
    'yandex_travel',
    'ostrovok',
    'sutochno',
    'avito',
    'bronevik',
    'hotels101',
    'onetwotrip'
  ));

-- Add new Russian channels for all existing hotels (skip if already exists)
INSERT INTO channels (hotel_id, name)
SELECT h.id, c.name
FROM hotels h
CROSS JOIN (VALUES
  ('yandex_travel'),
  ('ostrovok'),
  ('sutochno'),
  ('avito'),
  ('bronevik'),
  ('hotels101'),
  ('onetwotrip')
) AS c(name)
ON CONFLICT (hotel_id, name) DO NOTHING;
