Migrate video metadata to PostgreSQL for improved data management

Introduces a new video migration service to transfer video metadata from Bunny.net to PostgreSQL. Updates storage logic to prioritize PostgreSQL, removes redundant fields from the video schema, and adds database migration functionality to the server startup.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: d7424866-83d1-4486-a212-ac12b4c7becf
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/d7424866-83d1-4486-a212-ac12b4c7becf/i1Fg8VZ
This commit is contained in:
sebastjanartic
2025-08-28 17:23:05 +00:00
parent 443d92804e
commit f658b64b56
4 changed files with 99 additions and 26 deletions
-11
View File
@@ -8,10 +8,7 @@ export const videos = pgTable("videos", {
title: text("title").notNull(),
description: text("description").default("").notNull(),
thumbnailUrl: text("thumbnail_url").notNull(),
customThumbnailUrl: text("custom_thumbnail_url"),
videoUrl: text("video_url").notNull(),
videoUrlMp4: text("video_url_mp4"),
videoUrlIframe: text("video_url_iframe"),
duration: integer("duration").notNull(), // in seconds
views: integer("views").notNull().default(0),
category: text("category").default("").notNull(),
@@ -19,14 +16,6 @@ export const videos = pgTable("videos", {
isPublic: boolean("is_public").default(true).notNull(),
uploadStatus: text("upload_status").default("completed").notNull(), // pending, processing, completed, failed
originalFileName: text("original_file_name"),
fileSize: integer("file_size"), // in bytes
bitrate: integer("bitrate"), // in kbps
resolution: text("resolution"), // e.g., "1920x1080"
format: text("format"), // e.g., "mp4", "avi", "mov"
encoding: text("encoding"), // e.g., "h264", "h265"
bunnyId: varchar("bunny_id"), // Original Bunny.net video ID
bunnyLibraryId: varchar("bunny_library_id"), // Bunny.net library ID
source: text("source").default("bunny").notNull(), // bunny, upload, manual
createdAt: timestamp("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
updatedAt: timestamp("updated_at").notNull().default(sql`CURRENT_TIMESTAMP`),
});