70 行
2.4 KiB
SQL
70 行
2.4 KiB
SQL
CREATE TABLE `pose_analyses` (
|
|
`id` int AUTO_INCREMENT NOT NULL,
|
|
`videoId` int NOT NULL,
|
|
`userId` int NOT NULL,
|
|
`overallScore` float,
|
|
`poseMetrics` json,
|
|
`detectedIssues` json,
|
|
`corrections` json,
|
|
`exerciseType` varchar(64),
|
|
`framesAnalyzed` int,
|
|
`createdAt` timestamp NOT NULL DEFAULT (now()),
|
|
CONSTRAINT `pose_analyses_id` PRIMARY KEY(`id`)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `training_plans` (
|
|
`id` int AUTO_INCREMENT NOT NULL,
|
|
`userId` int NOT NULL,
|
|
`title` varchar(256) NOT NULL,
|
|
`skillLevel` enum('beginner','intermediate','advanced') NOT NULL,
|
|
`durationDays` int NOT NULL DEFAULT 7,
|
|
`exercises` json NOT NULL,
|
|
`isActive` int NOT NULL DEFAULT 1,
|
|
`adjustmentNotes` text,
|
|
`version` int NOT NULL DEFAULT 1,
|
|
`createdAt` timestamp NOT NULL DEFAULT (now()),
|
|
`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
|
|
CONSTRAINT `training_plans_id` PRIMARY KEY(`id`)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `training_records` (
|
|
`id` int AUTO_INCREMENT NOT NULL,
|
|
`userId` int NOT NULL,
|
|
`planId` int,
|
|
`exerciseName` varchar(128) NOT NULL,
|
|
`durationMinutes` int,
|
|
`completed` int NOT NULL DEFAULT 0,
|
|
`notes` text,
|
|
`poseScore` float,
|
|
`trainingDate` timestamp NOT NULL DEFAULT (now()),
|
|
`createdAt` timestamp NOT NULL DEFAULT (now()),
|
|
CONSTRAINT `training_records_id` PRIMARY KEY(`id`)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `training_videos` (
|
|
`id` int AUTO_INCREMENT NOT NULL,
|
|
`userId` int NOT NULL,
|
|
`title` varchar(256) NOT NULL,
|
|
`fileKey` varchar(512) NOT NULL,
|
|
`url` text NOT NULL,
|
|
`format` varchar(16) NOT NULL,
|
|
`fileSize` int,
|
|
`duration` float,
|
|
`exerciseType` varchar(64),
|
|
`analysisStatus` enum('pending','analyzing','completed','failed') DEFAULT 'pending',
|
|
`createdAt` timestamp NOT NULL DEFAULT (now()),
|
|
`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
|
|
CONSTRAINT `training_videos_id` PRIMARY KEY(`id`)
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `username_accounts` (
|
|
`id` int AUTO_INCREMENT NOT NULL,
|
|
`username` varchar(64) NOT NULL,
|
|
`userId` int NOT NULL,
|
|
`createdAt` timestamp NOT NULL DEFAULT (now()),
|
|
CONSTRAINT `username_accounts_id` PRIMARY KEY(`id`),
|
|
CONSTRAINT `username_accounts_username_unique` UNIQUE(`username`)
|
|
);
|
|
--> statement-breakpoint
|
|
ALTER TABLE `users` ADD `skillLevel` enum('beginner','intermediate','advanced') DEFAULT 'beginner';--> statement-breakpoint
|
|
ALTER TABLE `users` ADD `trainingGoals` text; |