summaryrefslogtreecommitdiff
path: root/db/migrations/0214_mature_norman_osborn.sql
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrations/0214_mature_norman_osborn.sql')
-rw-r--r--db/migrations/0214_mature_norman_osborn.sql30
1 files changed, 30 insertions, 0 deletions
diff --git a/db/migrations/0214_mature_norman_osborn.sql b/db/migrations/0214_mature_norman_osborn.sql
new file mode 100644
index 00000000..ca5c3359
--- /dev/null
+++ b/db/migrations/0214_mature_norman_osborn.sql
@@ -0,0 +1,30 @@
+CREATE TABLE "file_download_logs" (
+ "id" serial PRIMARY KEY NOT NULL,
+ "file_id" integer NOT NULL,
+ "user_id" varchar(50) NOT NULL,
+ "user_email" varchar(255),
+ "user_name" varchar(100),
+ "user_role" varchar(50),
+ "user_ip" "inet",
+ "user_agent" text,
+ "file_name" varchar(255),
+ "file_path" varchar(500),
+ "file_size" integer,
+ "downloaded_at" timestamp with time zone DEFAULT now() NOT NULL,
+ "success" boolean NOT NULL,
+ "error_message" text,
+ "session_id" varchar(100),
+ "request_id" varchar(50),
+ "referer" text,
+ "download_duration_ms" integer
+);
+--> statement-breakpoint
+CREATE TABLE "user_download_stats" (
+ "id" serial PRIMARY KEY NOT NULL,
+ "user_id" varchar(50) NOT NULL,
+ "date" timestamp with time zone NOT NULL,
+ "total_downloads" integer DEFAULT 0 NOT NULL,
+ "total_bytes" integer DEFAULT 0 NOT NULL,
+ "unique_files" integer DEFAULT 0 NOT NULL,
+ "last_download_at" timestamp with time zone
+);