From 947f0c6f0d7451421e39700f4325ff111af4c4fa Mon Sep 17 00:00:00 2001 From: Akhileshrangani4 Date: Sun, 5 Jan 2025 14:17:11 -0500 Subject: [PATCH] feat: schema change to add github token --- backend/database/src/index.ts | 12 +++++------- backend/database/src/schema.ts | 1 + 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/backend/database/src/index.ts b/backend/database/src/index.ts index 80e38e4..68e9ff9 100644 --- a/backend/database/src/index.ts +++ b/backend/database/src/index.ts @@ -5,13 +5,7 @@ import { z } from "zod" import { and, eq, sql } from "drizzle-orm" import * as schema from "./schema" -import { - Sandbox, - sandbox, - sandboxLikes, - user, - usersToSandboxes, -} from "./schema" +import { Sandbox, sandbox, user, usersToSandboxes } from "./schema" export interface Env { DB: D1Database @@ -316,6 +310,7 @@ export default { email: z.string().email(), username: z.string(), avatarUrl: z.string().optional(), + githubToken: z.string().nullable().optional(), createdAt: z.string().optional(), generations: z.number().optional(), tier: z.enum(["FREE", "PRO", "ENTERPRISE"]).optional(), @@ -331,6 +326,7 @@ export default { email, username, avatarUrl, + githubToken, createdAt, generations, tier, @@ -345,6 +341,7 @@ export default { email, username, avatarUrl, + githubToken, createdAt: createdAt ? new Date(createdAt) : new Date(), generations, tier, @@ -368,6 +365,7 @@ export default { email: z.string().email().optional(), username: z.string().optional(), avatarUrl: z.string().optional(), + githubToken: z.string().nullable().optional(), generations: z.number().optional(), }) diff --git a/backend/database/src/schema.ts b/backend/database/src/schema.ts index 33c86f3..0860923 100644 --- a/backend/database/src/schema.ts +++ b/backend/database/src/schema.ts @@ -12,6 +12,7 @@ export const user = sqliteTable("user", { email: text("email").notNull(), username: text("username").notNull().unique(), avatarUrl: text("avatarUrl"), + githubToken: text("githubToken"), createdAt: integer("createdAt", { mode: "timestamp_ms" }).default( sql`CURRENT_TIMESTAMP` ),