文件
tennis-training-hub/drizzle/0004_exotic_randall.sql

58 行
1.8 KiB
SQL

CREATE TABLE `notification_log` (
`id` int AUTO_INCREMENT NOT NULL,
`userId` int NOT NULL,
`reminderId` int,
`notificationType` varchar(32) NOT NULL,
`title` varchar(256) NOT NULL,
`message` text,
`isRead` int DEFAULT 0,
`createdAt` timestamp NOT NULL DEFAULT (now()),
CONSTRAINT `notification_log_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `training_reminders` (
`id` int AUTO_INCREMENT NOT NULL,
`userId` int NOT NULL,
`reminderType` varchar(32) NOT NULL,
`title` varchar(256) NOT NULL,
`message` text,
`timeOfDay` varchar(5) NOT NULL,
`daysOfWeek` json NOT NULL,
`isActive` int DEFAULT 1,
`lastTriggered` timestamp,
`createdAt` timestamp NOT NULL DEFAULT (now()),
`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
CONSTRAINT `training_reminders_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `tutorial_progress` (
`id` int AUTO_INCREMENT NOT NULL,
`userId` int NOT NULL,
`tutorialId` int NOT NULL,
`watched` int DEFAULT 0,
`comparisonVideoId` int,
`selfScore` float,
`notes` text,
`createdAt` timestamp NOT NULL DEFAULT (now()),
`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
CONSTRAINT `tutorial_progress_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `tutorial_videos` (
`id` int AUTO_INCREMENT NOT NULL,
`title` varchar(256) NOT NULL,
`category` varchar(64) NOT NULL,
`skillLevel` enum('beginner','intermediate','advanced') DEFAULT 'beginner',
`description` text,
`keyPoints` json,
`commonMistakes` json,
`videoUrl` text,
`thumbnailUrl` text,
`duration` int,
`sortOrder` int DEFAULT 0,
`isPublished` int DEFAULT 1,
`createdAt` timestamp NOT NULL DEFAULT (now()),
`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
CONSTRAINT `tutorial_videos_id` PRIMARY KEY(`id`)
);