=test_update_homework_tests_and_work_log
Some checks failed
CI / build-deploy (push) Has been cancelled

This commit is contained in:
SpecialX
2026-03-19 13:16:49 +08:00
parent eb08c0ab68
commit 99f116cb64
70 changed files with 7470 additions and 20220 deletions

View File

@@ -597,6 +597,23 @@ export const homeworkAnswers = mysqlTable("homework_answers", {
}),
}));
export const aiProviders = mysqlTable("ai_providers", {
id: id("id").primaryKey(),
provider: mysqlEnum("provider", ["zhipu", "openai", "gemini", "custom"]).notNull(),
baseUrl: varchar("base_url", { length: 512 }),
model: varchar("model", { length: 128 }).notNull(),
apiKeyEncrypted: text("api_key_encrypted").notNull(),
apiKeyLast4: varchar("api_key_last4", { length: 4 }),
isDefault: boolean("is_default").default(false).notNull(),
createdBy: varchar("created_by", { length: 128 }),
updatedBy: varchar("updated_by", { length: 128 }),
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at").defaultNow().onUpdateNow().notNull(),
}, (table) => ({
providerIdx: index("ai_provider_idx").on(table.provider),
defaultIdx: index("ai_provider_default_idx").on(table.isDefault),
}));
// Re-export old courses table if needed or deprecate it.
// Assuming we are replacing the old simple schema with this robust one.
// But if there were existing tables, we might keep them or comment them out.