 CREATE TABLE `coupons_master` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `for_type` enum('OPEN','INDIVIDUAL') NOT NULL DEFAULT 'OPEN',
  `individual_account_id` int(11) NOT NULL DEFAULT '0',
  `apply_type` enum('COUNTRY','DOW','DATE','TILLDATE') NOT NULL,
  `value_type` enum('FLAMT','FIFTY') NOT NULL,
  `code` varchar(55) NOT NULL,
  `valid_date` date DEFAULT NULL,
  `valid_dow` varchar(3) DEFAULT NULL,
  `amount` double(16,4) DEFAULT NULL,
  `apply_status` enum('APPLIED','EXPIRED','AVAILABLE') NOT NULL DEFAULT 'AVAILABLE',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;


CREATE TABLE `coupons_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `coupon_id` int(11) NOT NULL,
  `code` varchar(55) NOT NULL,
  `applied_on` timestamp NULL DEFAULT NULL,
  `applied_account` int(11) DEFAULT NULL,
  `credited_value` double(16,4) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;
