Initial commit from create-react-router

This commit is contained in:
Lukas Wölfer
2026-04-16 21:41:35 +02:00
commit 0a74a9a7ef
28 changed files with 7678 additions and 0 deletions

17
database/context.ts Normal file
View File

@@ -0,0 +1,17 @@
import { AsyncLocalStorage } from "node:async_hooks";
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
import * as schema from "./schema";
export const DatabaseContext = new AsyncLocalStorage<
PostgresJsDatabase<typeof schema>
>();
export function database() {
const db = DatabaseContext.getStore();
if (!db) {
throw new Error("DatabaseContext not set");
}
return db;
}

7
database/schema.ts Normal file
View File

@@ -0,0 +1,7 @@
import { integer, pgTable, varchar } from "drizzle-orm/pg-core";
export const guestBook = pgTable("guestBook", {
id: integer().primaryKey().generatedAlwaysAsIdentity(),
name: varchar({ length: 255 }).notNull(),
email: varchar({ length: 255 }).notNull().unique(),
});