This commit is contained in:
Turbobot
2024-03-21 13:41:16 +08:00
committed by giancarlo
commit bb58169fe9
204 changed files with 26228 additions and 0 deletions

22
packages/db/index.ts Normal file
View File

@@ -0,0 +1,22 @@
// Generated by prisma/post-generate.ts
import { Kysely } from "kysely";
import { PlanetScaleDialect } from "kysely-planetscale";
import { customAlphabet } from "nanoid";
import type { DB } from "./prisma/types";
export { jsonArrayFrom, jsonObjectFrom } from "kysely/helpers/postgres";
export * from "./prisma/types";
export * from "./prisma/enums";
export const db = new Kysely<DB>({
dialect: new PlanetScaleDialect({
url: process.env.DATABASE_URL,
}),
});
// Use custom alphabet without special chars for less chaotic, copy-able URLs
// Will not collide for a long long time: https://zelark.github.io/nano-id-cc/
export const genId = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz", 16);