-- Run this once in phpMyAdmin (select the database, then SQL tab).
-- Needed for «🔗 اتصال اشتراک»: a linked subscription has no plan_id (it
-- wasn't bought through a plan here), so there's no plan→duration→category
-- chain to find which panel it lives on. server_id records that directly,
-- so the subscription can be renewed later exactly like a normal purchase.
ALTER TABLE orders
    ADD COLUMN server_id INT UNSIGNED NULL AFTER plan_id,
    ADD FOREIGN KEY (server_id) REFERENCES servers(id) ON DELETE SET NULL,
    MODIFY COLUMN pay_method ENUM('wallet','card','linked') NOT NULL DEFAULT 'wallet';
