This commit is contained in:
David Senoner 2025-05-18 13:18:46 +02:00
commit 0738070ce1
287 changed files with 10116 additions and 0 deletions

View file

@ -0,0 +1,6 @@
import { env } from "$env/dynamic/private";
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
if (!env.DATABASE_URL) throw new Error("DATABASE_URL is not set");
const client = postgres(env.DATABASE_URL);
export const db = drizzle(client, { casing: "snake_case" });

View file

@ -0,0 +1,16 @@
import { integer, pgTable, text, timestamp } from "drizzle-orm/pg-core";
export const users = pgTable("users", {
id: text().primaryKey(),
age: integer(),
username: text().notNull().unique(),
passwordHash: text().notNull(),
});
export const sessions = pgTable("sessions", {
id: text().primaryKey(),
userId: text()
.notNull()
.references(() => users.id),
expiresAt: timestamp({ withTimezone: true, mode: "date" }).notNull(),
});