refactor(database): ♻️ Use ContentFormat to store media data

This commit is contained in:
Jesse Wierzbinski 2025-01-23 19:37:17 +01:00
parent 2f61cd8f0a
commit 9c30dacda7
No known key found for this signature in database
7 changed files with 227 additions and 132 deletions

View file

@ -305,18 +305,10 @@ export const Tokens = pgTable("Tokens", {
export const Medias = pgTable("Medias", {
id: id(),
url: text("url").notNull(),
remoteUrl: text("remote_url"),
thumbnailUrl: text("thumbnail_url"),
mimeType: text("mime_type").notNull(),
description: text("description"),
content: jsonb("content").notNull().$type<ContentFormat>(),
originalContent: jsonb("original_content").$type<ContentFormat>(),
thumbnail: jsonb("thumbnail").$type<ContentFormat>(),
blurhash: text("blurhash"),
sha256: text("sha256"),
fps: integer("fps"),
duration: integer("duration"),
width: integer("width"),
height: integer("height"),
size: integer("size"),
noteId: uuid("noteId").references(() => Notes.id, {
onDelete: "cascade",
onUpdate: "cascade",