實作個人收藏、個人活動紀錄
This commit is contained in:
@@ -178,6 +178,7 @@ CREATE TABLE `apps` (
|
||||
`type` VARCHAR(100) NOT NULL,
|
||||
`icon` VARCHAR(50) DEFAULT 'Bot',
|
||||
`icon_color` VARCHAR(100) DEFAULT 'from-blue-500 to-purple-500',
|
||||
`app_url` VARCHAR(500) NULL,
|
||||
`likes_count` INT DEFAULT 0,
|
||||
`views_count` INT DEFAULT 0,
|
||||
`rating` DECIMAL(3,2) DEFAULT 0.00,
|
||||
@@ -220,7 +221,25 @@ CREATE TABLE `proposals` (
|
||||
);
|
||||
|
||||
-- =====================================================
|
||||
-- 11. 競賽參與應用表 (competition_apps)
|
||||
-- 11. 評論投票表 (review_votes)
|
||||
-- =====================================================
|
||||
CREATE TABLE `review_votes` (
|
||||
`id` VARCHAR(36) PRIMARY KEY,
|
||||
`review_id` VARCHAR(36) NOT NULL,
|
||||
`user_id` VARCHAR(36) NOT NULL,
|
||||
`is_helpful` BOOLEAN NOT NULL, -- true = 有幫助, false = 沒幫助
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (`review_id`) REFERENCES `user_ratings`(`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
|
||||
UNIQUE KEY `unique_user_review_vote` (`user_id`, `review_id`),
|
||||
INDEX `idx_review` (`review_id`),
|
||||
INDEX `idx_user` (`user_id`),
|
||||
INDEX `idx_helpful` (`is_helpful`)
|
||||
);
|
||||
|
||||
-- =====================================================
|
||||
-- 12. 競賽參與應用表 (competition_apps)
|
||||
-- =====================================================
|
||||
CREATE TABLE `competition_apps` (
|
||||
`id` VARCHAR(36) PRIMARY KEY,
|
||||
@@ -415,7 +434,6 @@ CREATE TABLE `user_ratings` (
|
||||
|
||||
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`app_id`) REFERENCES `apps`(`id`) ON DELETE CASCADE,
|
||||
UNIQUE KEY `unique_user_app_rating` (`user_id`, `app_id`),
|
||||
INDEX `idx_user` (`user_id`),
|
||||
INDEX `idx_app` (`app_id`),
|
||||
INDEX `idx_rating` (`rating`)
|
||||
|
Reference in New Issue
Block a user