github repo creation flow
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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", {
|
||||
|
||||
Reference in New Issue
Block a user