CREATE TABLE IF NOT EXISTS `RewardReward` ( 
`Id` int(11) NOT NULL AUTO_INCREMENT, 
`Name` TEXT  NOT NULL,
`Code` TEXT  NOT NULL,
`Action` TEXT  NOT NULL,
`ResponseType` TEXT  NOT NULL,
`Points` INT  NOT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB  DEFAULT CHARACTER SET `utf8`; 

CREATE TABLE IF NOT EXISTS `RewardUser` ( 
`Id` int(11) NOT NULL AUTO_INCREMENT, 
`RewardId` INT  NOT NULL,
`UserId` INT  NOT NULL,
`Response` TEXT  NOT NULL,
`Status` INT  NOT NULL,
PRIMARY KEY (`Id`),
CONSTRAINT `Reward_RewardUser` FOREIGN KEY (`RewardId`) REFERENCES `RewardReward`(`Id`),
CONSTRAINT `ee_user_RewardUser` FOREIGN KEY (`UserId`) REFERENCES `ee_user`(`Id`)
) ENGINE=InnoDB  DEFAULT CHARACTER SET `utf8`; 

CREATE TABLE IF NOT EXISTS `RewardGifts` ( 
`Id` int(11) NOT NULL AUTO_INCREMENT, 
`Name` TEXT  NOT NULL,
`Description` TEXT  NOT NULL,
`Points` INT  NOT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB  DEFAULT CHARACTER SET `utf8`; 

CREATE TABLE IF NOT EXISTS `RewardUserClaim` ( 
`Id` int(11) NOT NULL AUTO_INCREMENT, 
`RewardId` INT  NOT NULL,
`UserId` INT  NOT NULL,
`Status` INT  NOT NULL,
`DateClaim` DATE  NOT NULL,
`DateValid` DATE  NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB  DEFAULT CHARACTER SET `utf8`; 