fp/scripts/data-migrations/2024-11-21-relate-vtubers-t...

19 lines
383 B
PL/PgSQL

BEGIN;
-- SELECT * FROM api.vods AS vods
-- INNER JOIN api.vods_vtuber_links AS links
-- ON vods.id = links.vtuber_id
-- INSERT INTO api.vods (vtuber)
-- SELECT vtuber
-- FROM api.vods_vtuber_links
-- WHERE api.vods.id = api.vods_vtuber_links.vtuber_id;
UPDATE api.vods
SET vtuber_id = links.vtuber_id
FROM api.vods_vtuber_links links
WHERE api.vods.id = links.vod_id;
COMMIT;