-- Sunucu yenileme iu015flemleri tablosu
CREATE TABLE `server_renewals` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `server_id` int(11) NOT NULL,
  `package_id` int(11) NOT NULL,
  `current_expiry_date` datetime NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `payment_method` enum('credit_card','bank_transfer','balance') NOT NULL,
  `payment_id` varchar(50) DEFAULT NULL,
  `transaction_id` varchar(50) DEFAULT NULL,
  `status` enum('pending','completed','rejected','cancelled') NOT NULL DEFAULT 'pending',
  `admin_note` text DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `approved_at` datetime DEFAULT NULL,
  `rejected_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `server_id` (`server_id`),
  KEY `package_id` (`package_id`),
  KEY `status` (`status`),
  CONSTRAINT `server_renewals_ibfk_1` FOREIGN KEY (`server_id`) REFERENCES `virtual_servers` (`id`) ON DELETE CASCADE,
  CONSTRAINT `server_renewals_ibfk_2` FOREIGN KEY (`package_id`) REFERENCES `server_packages` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
