Initial commit

This commit is contained in:
Ammaar Reshi
2025-01-04 14:06:53 +00:00
parent 7082408604
commit d6025af146
23760 changed files with 3299690 additions and 0 deletions

15
db/index.ts Normal file
View File

@ -0,0 +1,15 @@
import { drizzle } from "drizzle-orm/neon-serverless";
import ws from "ws";
import * as schema from "@db/schema";
if (!process.env.DATABASE_URL) {
throw new Error(
"DATABASE_URL must be set. Did you forget to provision a database?",
);
}
export const db = drizzle({
connection: process.env.DATABASE_URL,
schema,
ws: ws,
});

13
db/schema.ts Normal file
View File

@ -0,0 +1,13 @@
import { pgTable, text, serial, integer, boolean } from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
export const users = pgTable("users", {
id: serial("id").primaryKey(),
username: text("username").unique().notNull(),
password: text("password").notNull(),
});
export const insertUserSchema = createInsertSchema(users);
export const selectUserSchema = createSelectSchema(users);
export type InsertUser = typeof users.$inferInsert;
export type SelectUser = typeof users.$inferSelect;