CREATE TABLE IF NOT EXISTS `discounts` (
  `id` int(11) NOT NULL auto_increment,
  `discounttype_id` int(11) NOT NULL,
  `entity_id` int(11) NOT NULL,
  `discount` int(11) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `discounttype_id` (`discounttype_id`),
  KEY `entity_id` (`entity_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
-- ### --
CREATE TABLE IF NOT EXISTS `discountupdates` (
  `template_id` int(11) NOT NULL,
  `discounted_price` int(11) NOT NULL,
  PRIMARY KEY  (`template_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ### --
ALTER TABLE `templates` ADD `discounted_price` INT NOT NULL AFTER `price`;
