i hyperfocused and here is v1

This commit is contained in:
Rose 2024-04-19 00:15:20 -04:00
parent 8f43e6a6a9
commit 4090fd621e
No known key found for this signature in database
34 changed files with 4135 additions and 22 deletions

View file

@ -0,0 +1,23 @@
import { drizzle } from "drizzle-orm/node-postgres";
import { migrate } from "drizzle-orm/node-postgres/migrator";
import { resolve } from "node:path";
import pg from "pg";
import * as schema from "./schema.ts";
const client = new pg.Client({
host: process.env.DB_HOST,
port: Number(process.env.DB_PORT),
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
});
await client.connect();
export const database = drizzle(client, { schema });
await migrate(database, {
migrationsFolder: resolve(import.meta.dirname, "../migrations"),
});
export * as Drizzle from "drizzle-orm";
export * as Schema from "./schema.ts";

View file

@ -0,0 +1,10 @@
import { bigint, pgTable } from "drizzle-orm/pg-core";
export const servers = pgTable("servers", {
id: bigint("id", { mode: "bigint" }).primaryKey(),
channel: bigint("channel", { mode: "bigint" }).notNull(),
role: bigint("role", { mode: "bigint" }),
});
export type Server = typeof servers.$inferSelect;
export type NewServer = typeof servers.$inferInsert;