fix: update schemes
This commit is contained in:
parent
dbf82d2801
commit
047c924193
|
|
@ -83,7 +83,7 @@ export const generations = pgTable(
|
||||||
// Request context
|
// Request context
|
||||||
requestId: uuid('request_id'),
|
requestId: uuid('request_id'),
|
||||||
userAgent: text('user_agent'),
|
userAgent: text('user_agent'),
|
||||||
ipAddress: varchar('ip_address', { length: 45 }), // IPv6 max length
|
ipAddress: text('ip_address'),
|
||||||
|
|
||||||
// Metadata
|
// Metadata
|
||||||
meta: jsonb('meta').$type<Record<string, unknown>>().notNull().default({}),
|
meta: jsonb('meta').$type<Record<string, unknown>>().notNull().default({}),
|
||||||
|
|
@ -130,6 +130,9 @@ export const generations = pgTable(
|
||||||
|
|
||||||
// Index for request correlation
|
// Index for request correlation
|
||||||
requestIdx: index('idx_generations_request').on(table.requestId),
|
requestIdx: index('idx_generations_request').on(table.requestId),
|
||||||
|
|
||||||
|
// Index for API key audit trail
|
||||||
|
apiKeyIdx: index('idx_generations_api_key').on(table.apiKeyId),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ export const images = pgTable(
|
||||||
// File metadata
|
// File metadata
|
||||||
mimeType: varchar('mime_type', { length: 100 }).notNull(),
|
mimeType: varchar('mime_type', { length: 100 }).notNull(),
|
||||||
fileSize: integer('file_size').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
|
// Dimensions
|
||||||
width: integer('width'),
|
width: integer('width'),
|
||||||
|
|
@ -127,6 +127,9 @@ export const images = pgTable(
|
||||||
|
|
||||||
// Index for file hash (deduplication)
|
// Index for file hash (deduplication)
|
||||||
hashIdx: index('idx_images_hash').on(table.fileHash),
|
hashIdx: index('idx_images_hash').on(table.fileHash),
|
||||||
|
|
||||||
|
// Index for API key audit trail
|
||||||
|
apiKeyIdx: index('idx_images_api_key').on(table.apiKeyId),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue