@@ -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
1627CREATE 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
2248CREATE 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
103130CREATE UNIQUE INDEX `user_username_unique ` ON ` user` (` username` );-- > statement-breakpoint
0 commit comments