<?php
declare(strict_types=1);

return [
    'up' => "ALTER TABLE members ADD COLUMN transferred_from_transfer_id BIGINT UNSIGNED NULL AFTER transferred_from_waiver_id;
UPDATE members m
JOIN transfer_requests tr ON tr.target_member_id = m.id AND tr.status = 'completed'
SET m.transferred_from_transfer_id = tr.id
WHERE m.transferred_from_transfer_id IS NULL",
    'down' => "ALTER TABLE members DROP COLUMN transferred_from_transfer_id",
];
