Skip to content

Commit 3a0da17

Browse files
committed
? ref
1 parent e1e2b09 commit 3a0da17

File tree

9 files changed

+959
-710
lines changed

9 files changed

+959
-710
lines changed

src/lib/auth/middleware.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface Env {
77
TURSO_DATABASE_URL: string
88
TURSO_DATABASE_AUTH_TOKEN?: string
99
DISCORD_WEBHOOK?: string
10+
CDN: R2Bucket
1011
}
1112

1213
export interface AuthVariables {

src/lib/db/migrations/0000_closed_purifiers.sql renamed to src/lib/db/migrations/0000_mysterious_james_howlett.sql

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,44 @@ CREATE TABLE `asset` (
77
`uploaded_by` text NOT NULL,
88
`download_count` integer DEFAULT 0 NOT NULL,
99
`view_count` integer DEFAULT 0 NOT NULL,
10+
`is_suggestive` integer DEFAULT false NOT NULL,
11+
`status` text DEFAULT 'pending' NOT NULL,
1012
`hash` text NOT NULL,
1113
`size` integer NOT NULL,
1214
`extension` text NOT NULL,
1315
FOREIGN KEY (`uploaded_by`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
1416
);
1517
--> statement-breakpoint
18+
CREATE TABLE `asset_link` (
19+
`id` text PRIMARY KEY NOT NULL,
20+
`asset_id` text NOT NULL,
21+
`to_asset_id` text NOT NULL,
22+
`created_at` integer NOT NULL,
23+
FOREIGN KEY (`asset_id`) REFERENCES `asset`(`id`) ON UPDATE no action ON DELETE no action,
24+
FOREIGN KEY (`to_asset_id`) REFERENCES `asset`(`id`) ON UPDATE no action ON DELETE no action
25+
);
26+
--> statement-breakpoint
1627
CREATE TABLE `asset_to_tag` (
1728
`id` text PRIMARY KEY NOT NULL,
1829
`asset_id` text NOT NULL,
1930
`tag_id` text NOT NULL
2031
);
2132
--> statement-breakpoint
33+
CREATE TABLE `download_history` (
34+
`id` text PRIMARY KEY NOT NULL,
35+
`user_id` text NOT NULL,
36+
`created_at` integer NOT NULL,
37+
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
38+
);
39+
--> statement-breakpoint
40+
CREATE TABLE `download_history_to_asset` (
41+
`id` text PRIMARY KEY NOT NULL,
42+
`download_history_id` text NOT NULL,
43+
`asset_id` text NOT NULL,
44+
FOREIGN KEY (`download_history_id`) REFERENCES `download_history`(`id`) ON UPDATE no action ON DELETE no action,
45+
FOREIGN KEY (`asset_id`) REFERENCES `asset`(`id`) ON UPDATE no action ON DELETE no action
46+
);
47+
--> statement-breakpoint
2248
CREATE TABLE `saved_asset` (
2349
`id` text PRIMARY KEY NOT NULL,
2450
`user_id` text NOT NULL,
@@ -97,7 +123,8 @@ CREATE TABLE `user` (
97123
`email_verified` integer DEFAULT false NOT NULL,
98124
`image` text,
99125
`created_at` integer NOT NULL,
100-
`updated_at` integer NOT NULL
126+
`updated_at` integer NOT NULL,
127+
`role` text DEFAULT 'user' NOT NULL
101128
);
102129
--> statement-breakpoint
103130
CREATE UNIQUE INDEX `user_username_unique` ON `user` (`username`);--> statement-breakpoint

0 commit comments

Comments
 (0)