文件
tennis-training-hub/drizzle/0003_married_iron_lad.sql

22 行
796 B
SQL

CREATE TABLE `daily_checkins` (
`id` int AUTO_INCREMENT NOT NULL,
`userId` int NOT NULL,
`checkinDate` varchar(10) NOT NULL,
`streakCount` int NOT NULL DEFAULT 1,
`notes` text,
`minutesTrained` int DEFAULT 0,
`createdAt` timestamp NOT NULL DEFAULT (now()),
CONSTRAINT `daily_checkins_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `user_badges` (
`id` int AUTO_INCREMENT NOT NULL,
`userId` int NOT NULL,
`badgeKey` varchar(64) NOT NULL,
`earnedAt` timestamp NOT NULL DEFAULT (now()),
CONSTRAINT `user_badges_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
ALTER TABLE `users` ADD `currentStreak` int DEFAULT 0;--> statement-breakpoint
ALTER TABLE `users` ADD `longestStreak` int DEFAULT 0;--> statement-breakpoint
ALTER TABLE `users` ADD `totalShots` int DEFAULT 0;