feat: schema change to add github token

This commit is contained in:
Akhileshrangani4 2025-01-05 14:17:11 -05:00
parent f800008487
commit 947f0c6f0d
2 changed files with 6 additions and 7 deletions

View File

@ -5,13 +5,7 @@ import { z } from "zod"
import { and, eq, sql } from "drizzle-orm" import { and, eq, sql } from "drizzle-orm"
import * as schema from "./schema" import * as schema from "./schema"
import { import { Sandbox, sandbox, user, usersToSandboxes } from "./schema"
Sandbox,
sandbox,
sandboxLikes,
user,
usersToSandboxes,
} from "./schema"
export interface Env { export interface Env {
DB: D1Database DB: D1Database
@ -316,6 +310,7 @@ export default {
email: z.string().email(), email: z.string().email(),
username: z.string(), username: z.string(),
avatarUrl: z.string().optional(), avatarUrl: z.string().optional(),
githubToken: z.string().nullable().optional(),
createdAt: z.string().optional(), createdAt: z.string().optional(),
generations: z.number().optional(), generations: z.number().optional(),
tier: z.enum(["FREE", "PRO", "ENTERPRISE"]).optional(), tier: z.enum(["FREE", "PRO", "ENTERPRISE"]).optional(),
@ -331,6 +326,7 @@ export default {
email, email,
username, username,
avatarUrl, avatarUrl,
githubToken,
createdAt, createdAt,
generations, generations,
tier, tier,
@ -345,6 +341,7 @@ export default {
email, email,
username, username,
avatarUrl, avatarUrl,
githubToken,
createdAt: createdAt ? new Date(createdAt) : new Date(), createdAt: createdAt ? new Date(createdAt) : new Date(),
generations, generations,
tier, tier,
@ -368,6 +365,7 @@ export default {
email: z.string().email().optional(), email: z.string().email().optional(),
username: z.string().optional(), username: z.string().optional(),
avatarUrl: z.string().optional(), avatarUrl: z.string().optional(),
githubToken: z.string().nullable().optional(),
generations: z.number().optional(), generations: z.number().optional(),
}) })

View File

@ -12,6 +12,7 @@ export const user = sqliteTable("user", {
email: text("email").notNull(), email: text("email").notNull(),
username: text("username").notNull().unique(), username: text("username").notNull().unique(),
avatarUrl: text("avatarUrl"), avatarUrl: text("avatarUrl"),
githubToken: text("githubToken"),
createdAt: integer("createdAt", { mode: "timestamp_ms" }).default( createdAt: integer("createdAt", { mode: "timestamp_ms" }).default(
sql`CURRENT_TIMESTAMP` sql`CURRENT_TIMESTAMP`
), ),