feat: add question bank schema
Made-with: Cursor
This commit is contained in:
18
src/db/schema/questionCacheMeta.ts
Normal file
18
src/db/schema/questionCacheMeta.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user