github repo creation flow

This commit is contained in:
Will Chen
2025-04-14 21:55:51 -07:00
parent 7ad83a2bdc
commit 05a97d31c4
12 changed files with 288 additions and 10 deletions

View File

@@ -8,6 +8,7 @@ import { migrate } from "drizzle-orm/better-sqlite3/migrator";
import path from "node:path";
import fs from "node:fs";
import { getDyadAppPath, getUserDataPath } from "../paths/paths";
import { eq } from "drizzle-orm";
// Database connection factory
let _db: ReturnType<typeof drizzle> | null = null;
@@ -91,3 +92,14 @@ try {
export const db = _db as any as BetterSQLite3Database<typeof schema> & {
$client: Database.Database;
};
export async function updateAppGithubRepo(
appId: number,
org: string,
repo: string
): Promise<void> {
await db
.update(schema.apps)
.set({ githubOrg: org, githubRepo: repo })
.where(eq(schema.apps.id, appId));
}

View File

@@ -12,6 +12,8 @@ export const apps = sqliteTable("apps", {
updatedAt: integer("updated_at", { mode: "timestamp" })
.notNull()
.default(sql`(unixepoch())`),
githubOrg: text("github_org"),
githubRepo: text("github_repo"),
});
export const chats = sqliteTable("chats", {