19 lines
890 B
TypeScript
19 lines
890 B
TypeScript
import { pgTable, uuid, varchar, integer, timestamp } from 'drizzle-orm/pg-core';
|
|
import { jsonb } from 'drizzle-orm/pg-core';
|
|
import { questionBank } from './questionBank.js';
|
|
|
|
export const questionCacheMeta = pgTable('question_cache_meta', {
|
|
id: uuid('id').primaryKey().defaultRandom(),
|
|
questionBankId: uuid('question_bank_id')
|
|
.notNull()
|
|
.references(() => questionBank.id, { onDelete: 'cascade' }),
|
|
llmModel: varchar('llm_model', { length: 100 }).notNull(),
|
|
promptHash: varchar('prompt_hash', { length: 64 }).notNull(),
|
|
generationTimeMs: integer('generation_time_ms').notNull(),
|
|
rawResponse: jsonb('raw_response').$type<unknown>(),
|
|
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
});
|
|
|
|
export type QuestionCacheMeta = typeof questionCacheMeta.$inferSelect;
|
|
export type NewQuestionCacheMeta = typeof questionCacheMeta.$inferInsert;
|