-- Add full-refund support to an existing Yipay installation. -- Import once after sql/yipay_payment.sql. CREATE TABLE `yipay_refunds` ( `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `order_no` varchar(32) NOT NULL, `gateway_trade_no` varchar(80) NOT NULL, `amount` decimal(12,2) NOT NULL, `status` varchar(16) NOT NULL DEFAULT 'success', `gateway_message` varchar(500) NOT NULL DEFAULT '', `admin_user_id` bigint(20) UNSIGNED NOT NULL, `referral_reversal_amount` decimal(12,2) NOT NULL DEFAULT 0.00, `requested_at` int(10) UNSIGNED NOT NULL DEFAULT 0, `completed_at` int(10) UNSIGNED NOT NULL DEFAULT 0, `updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (`id`), UNIQUE KEY `uniq_yipay_refund_order` (`order_no`), UNIQUE KEY `uniq_yipay_refund_trade` (`gateway_trade_no`), KEY `idx_yipay_refund_status_time` (`status`,`requested_at`), KEY `idx_yipay_refund_admin_time` (`admin_user_id`,`requested_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;