feat: add originalFilename and fileExtension to images schema

This commit is contained in:
Oleg Proskurin 2025-12-27 19:21:11 +07:00
parent 191b8c8501
commit e57c66f318
1 changed files with 4 additions and 1 deletions

View File

@ -46,7 +46,8 @@ export const images = pgTable(
pendingFlowId: text('pending_flow_id'), // Temporary UUID for lazy flow pattern
apiKeyId: uuid('api_key_id').references(() => apiKeys.id, { onDelete: 'set null' }),
// Storage (MinIO path format: orgSlug/projectSlug/category/YYYY-MM/filename.ext)
// Storage (MinIO path format: orgSlug/projectSlug/img/{imageId})
// Note: imageId = this record's UUID, filename has no extension
storageKey: varchar('storage_key', { length: 500 }).notNull().unique(),
storageUrl: text('storage_url').notNull(),
@ -54,6 +55,8 @@ export const images = pgTable(
mimeType: varchar('mime_type', { length: 100 }).notNull(),
fileSize: integer('file_size').notNull(),
fileHash: varchar('file_hash', { length: 64 }), // SHA-256 for deduplication
originalFilename: varchar('original_filename', { length: 255 }), // User's original filename
fileExtension: varchar('file_extension', { length: 20 }), // Original extension (png, jpg, etc.)
// Dimensions
width: integer('width'),