i have requirement
- reward will give to user but reward have some condition a. reward can have limit hourly , daily , monthly
here is table maintaining user reward tracker
CREATE TABLE `user_reward_usage` (
`id` bigint NOT NULL AUTO_INCREMENT,
`user_id` bigint NOT NULL,
`reward_id` int NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON
UPDATE CURRENT_TIMESTAMP,
`hourly_count` int DEFAULT NULL,
`daily_count` int DEFAULT NULL,
`monthly_count` int DEFAULT NULL,
PRIMARY KEY (`id`),
)
any suggestion in above table or any flaws.
user_id
be thePRIMARY_KEY
? (It feels like the table does not keep track of individual rewards, but only the totals to-date.)