-- Create "payments" table CREATE TABLE `payments` (`id` bigint NOT NULL AUTO_INCREMENT, `amount` double NOT NULL, `currency` enum('USD','ILS') NOT NULL, `time` timestamp NOT NULL, `description` varchar(255) NOT NULL, `status` enum('pending','completed','failed') NOT NULL, `card_id` bigint NOT NULL, PRIMARY KEY (`id`), INDEX `payment_status_time` (`status`, `time`), INDEX `payments_cards_payments` (`card_id`), CONSTRAINT `payments_cards_payments` FOREIGN KEY (`card_id`) REFERENCES `cards` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT `amount_positive` CHECK (`amount` > 0)) CHARSET utf8mb4 COLLATE utf8mb4_bin;