forked from Xeio/IdleCodeRedeemer
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path0000_material_guardsmen.sql
More file actions
49 lines (49 loc) · 1.67 KB
/
Copy path0000_material_guardsmen.sql
File metadata and controls
49 lines (49 loc) · 1.67 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
42
43
44
45
46
47
48
49
CREATE TABLE `users` (
`discord_id` text PRIMARY KEY NOT NULL,
`user_id` text NOT NULL,
`user_hash` text NOT NULL,
`server` text,
`instance_id` text,
`created_at` text DEFAULT CURRENT_TIMESTAMP,
`updated_at` text DEFAULT CURRENT_TIMESTAMP
);
--> statement-breakpoint
CREATE TABLE `audit_log` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`discord_id` text,
`action` text NOT NULL,
`details` text,
`created_at` text DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (`discord_id`) REFERENCES `users`(`discord_id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE TABLE `redeemed_codes` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`code` text NOT NULL,
`discord_id` text,
`redeemed_at` text DEFAULT CURRENT_TIMESTAMP,
`status` text,
`loot_detail` text,
`is_public` integer DEFAULT 0,
`expires_at` text,
FOREIGN KEY (`discord_id`) REFERENCES `users`(`discord_id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE UNIQUE INDEX `redeemed_codes_code_unique` ON `redeemed_codes` (`code`);--> statement-breakpoint
CREATE TABLE `backfill_operations` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`initiated_by` text NOT NULL,
`started_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
`completed_at` text,
`codes_found` integer DEFAULT 0 NOT NULL,
`codes_redeemed` integer DEFAULT 0 NOT NULL,
`status` text DEFAULT 'in_progress' NOT NULL
);
--> statement-breakpoint
CREATE TABLE `pending_codes` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`code` text NOT NULL,
`discord_id` text,
`found_at` text DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (`discord_id`) REFERENCES `users`(`discord_id`) ON UPDATE no action ON DELETE no action
);