fix: migration 036 — delete old channels before altering constraint + remove TravelLine refs + hide hotel_admin from roles tab

This commit is contained in:
2026-03-26 01:10:48 +03:00
parent 566c6a5e41
commit 17012ae3ca
3 changed files with 10 additions and 8 deletions

View File

@@ -1,4 +1,7 @@
-- Replace old channel constraint with Russian market channels
-- 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 (
@@ -12,9 +15,6 @@ ALTER TABLE channels ADD CONSTRAINT channels_name_check
'onetwotrip'
));
-- Remove old non-RU channels from all hotels
DELETE FROM channels WHERE name IN ('airbnb', 'expedia', 'vrbo');
-- Add new Russian channels for all existing hotels (skip if already exists)
INSERT INTO channels (hotel_id, name)
SELECT h.id, c.name