fix: update schemes

This commit is contained in:
Oleg Proskurin 2025-10-26 23:14:05 +07:00
parent dbf82d2801
commit 047c924193
2 changed files with 8 additions and 2 deletions

View File

@ -83,7 +83,7 @@ export const generations = pgTable(
// Request context
requestId: uuid('request_id'),
userAgent: text('user_agent'),
ipAddress: varchar('ip_address', { length: 45 }), // IPv6 max length
ipAddress: text('ip_address'),
// Metadata
meta: jsonb('meta').$type<Record<string, unknown>>().notNull().default({}),
@ -130,6 +130,9 @@ export const generations = pgTable(
// Index for request correlation
requestIdx: index('idx_generations_request').on(table.requestId),
// Index for API key audit trail
apiKeyIdx: index('idx_generations_api_key').on(table.apiKeyId),
}),
);

View File

@ -52,7 +52,7 @@ export const images = pgTable(
// File metadata
mimeType: varchar('mime_type', { length: 100 }).notNull(),
fileSize: integer('file_size').notNull(),
fileHash: varchar('file_hash', { length: 64 }).notNull(), // SHA-256 for deduplication
fileHash: varchar('file_hash', { length: 64 }), // SHA-256 for deduplication
// Dimensions
width: integer('width'),
@ -127,6 +127,9 @@ export const images = pgTable(
// Index for file hash (deduplication)
hashIdx: index('idx_images_hash').on(table.fileHash),
// Index for API key audit trail
apiKeyIdx: index('idx_images_api_key').on(table.apiKeyId),
}),
);