forked from codechefPesuecc/CodeChef-PESUECC-Chapter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0000_pale_santa_claus.sql
More file actions
41 lines (41 loc) · 1.42 KB
/
Copy path0000_pale_santa_claus.sql
File metadata and controls
41 lines (41 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
CREATE TABLE `email_verifications` (
`id` text PRIMARY KEY NOT NULL,
`user_id` text NOT NULL,
`email` text NOT NULL,
`code_hash` text NOT NULL,
`expires_at` integer NOT NULL,
`attempts` integer DEFAULT 0 NOT NULL,
`created_at` integer NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `submissions` (
`id` text PRIMARY KEY NOT NULL,
`challenge_slug` text NOT NULL,
`user_id` text NOT NULL,
`language` text NOT NULL,
`code` text NOT NULL,
`status` text DEFAULT 'pending' NOT NULL,
`runtime_ms` integer,
`elapsed_seconds` integer,
`flags` integer DEFAULT 0 NOT NULL,
`flags_breakdown` text,
`created_at` integer NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `users` (
`id` text PRIMARY KEY NOT NULL,
`username` text NOT NULL,
`email` text NOT NULL,
`email_verified` integer DEFAULT false NOT NULL,
`srn` text,
`prn` text NOT NULL,
`password_hash` text NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `users_username_unique` ON `users` (`username`);--> statement-breakpoint
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
CREATE UNIQUE INDEX `users_srn_unique` ON `users` (`srn`);--> statement-breakpoint
CREATE UNIQUE INDEX `users_prn_unique` ON `users` (`prn`);