From 72987f009de966fb56828321794bccac2bb3b89d Mon Sep 17 00:00:00 2001 From: Taken Date: Wed, 2 Oct 2024 23:57:58 +0200 Subject: [PATCH] Updated schema --- src/db/schema.ts | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/db/schema.ts b/src/db/schema.ts index 36c6f21..cb1d050 100644 --- a/src/db/schema.ts +++ b/src/db/schema.ts @@ -1,32 +1,45 @@ -import { bigint, pgTable, serial, text } from "drizzle-orm/pg-core" +import { bigint, pgTable, serial, text, timestamp } from "drizzle-orm/pg-core" + +const createdAt = timestamp("createdAt").notNull().defaultNow() +const updatedAt = timestamp("updatedAt").notNull().defaultNow().$onUpdate(() => new Date()) export const verifies = pgTable("verifies", { id: serial("id").primaryKey(), userID: text("userID").notNull(), - uuid: text("uuid").notNull() + uuid: text("uuid").notNull(), + createdAt, + updatedAt }) export const guildApps = pgTable("guildApps", { id: serial("id").primaryKey(), userID: text("userID").notNull(), - uuid: text("uuid").notNull() + uuid: text("uuid").notNull(), + createdAt, + updatedAt }) export const staffApps = pgTable("staffApps", { id: serial("id").primaryKey(), userID: text("userID").notNull(), - uuid: text("uuid").notNull() + uuid: text("uuid").notNull(), + createdAt, + updatedAt }) export const waitingLists = pgTable("waitingLists", { id: serial("id").primaryKey(), userID: text("userID").notNull(), uuid: text("uuid").notNull(), - timestamp: bigint("timestamp", { mode: "number" }).notNull() + timestamp: bigint("timestamp", { mode: "number" }).notNull(), + createdAt, + updatedAt }) export const settings = pgTable("settings", { id: serial("id").primaryKey(), name: text("name").notNull(), - value: text("value").notNull() + value: text("value").notNull(), + createdAt, + updatedAt })