
CREATE TABLE IF NOT EXISTS `discounts` (
  `id` INT PRIMARY KEY AUTO_INCREMENT,
  `code` VARCHAR(255) NOT NULL UNIQUE,
  `type` ENUM('percentage', 'fixed') NOT NULL,
  `value` DECIMAL(10, 2) NOT NULL,
  `start_date` DATETIME,
  `end_date` DATETIME,
  `uses_limit` INT,
  `times_used` INT DEFAULT 0,
  `is_active` BOOLEAN DEFAULT TRUE,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
