44 lines
1.6 KiB
SQL
44 lines
1.6 KiB
SQL
-- Update flyer URLs from example.com to environment-specific URLs
|
|
--
|
|
-- This script should be run after determining the correct base URL for the environment:
|
|
-- - Dev container: http://127.0.0.1
|
|
-- - Test environment: https://flyer-crawler-test.projectium.com
|
|
-- - Production: https://flyer-crawler.projectium.com
|
|
|
|
-- For dev container (run in dev database):
|
|
UPDATE flyers
|
|
SET
|
|
image_url = REPLACE(image_url, 'example.com', '127.0.0.1'),
|
|
image_url = REPLACE(image_url, 'https://', 'http://'),
|
|
icon_url = REPLACE(icon_url, 'example.com', '127.0.0.1'),
|
|
icon_url = REPLACE(icon_url, 'https://', 'http://')
|
|
WHERE
|
|
image_url LIKE '%example.com%'
|
|
OR icon_url LIKE '%example.com%';
|
|
|
|
-- For test environment (run in test database):
|
|
-- UPDATE flyers
|
|
-- SET
|
|
-- image_url = REPLACE(image_url, 'example.com', 'flyer-crawler-test.projectium.com'),
|
|
-- icon_url = REPLACE(icon_url, 'example.com', 'flyer-crawler-test.projectium.com')
|
|
-- WHERE
|
|
-- image_url LIKE '%example.com%'
|
|
-- OR icon_url LIKE '%example.com%';
|
|
|
|
-- For production (run in production database):
|
|
-- UPDATE flyers
|
|
-- SET
|
|
-- image_url = REPLACE(image_url, 'example.com', 'flyer-crawler.projectium.com'),
|
|
-- icon_url = REPLACE(icon_url, 'example.com', 'flyer-crawler.projectium.com')
|
|
-- WHERE
|
|
-- image_url LIKE '%example.com%'
|
|
-- OR icon_url LIKE '%example.com%';
|
|
|
|
-- Verify the changes:
|
|
SELECT flyer_id, image_url, icon_url
|
|
FROM flyers
|
|
WHERE image_url LIKE '%127.0.0.1%'
|
|
OR icon_url LIKE '%127.0.0.1%'
|
|
OR image_url LIKE '%flyer-crawler%'
|
|
OR icon_url LIKE '%flyer-crawler%';
|