From 1af996376cb16088f15923dca5ca0187238889d1 Mon Sep 17 00:00:00 2001 From: Sukma Gladys Date: Sun, 4 Aug 2024 21:10:40 +0700 Subject: [PATCH] create: questions schema --- apps/backend/src/drizzle/schema/questions.ts | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 apps/backend/src/drizzle/schema/questions.ts diff --git a/apps/backend/src/drizzle/schema/questions.ts b/apps/backend/src/drizzle/schema/questions.ts new file mode 100644 index 0000000..3bc582d --- /dev/null +++ b/apps/backend/src/drizzle/schema/questions.ts @@ -0,0 +1,21 @@ +import { createId } from "@paralleldrive/cuid2"; +import { + boolean, + pgTable, + text, + timestamp, + varchar, +} from "drizzle-orm/pg-core"; +import { subAspects } from "./subAspects" + +export const questions = pgTable("questions", { + id: varchar("id", { length: 50 }) + .primaryKey() + .$defaultFn(() => createId()), + question: text("question"), + needFile: boolean("needFile").default(false), + createdAt: timestamp("createdAt", { mode: "date" }).defaultNow(), + updatedAt: timestamp("updatedAt", { mode: "date" }).defaultNow(), + deletedAt: timestamp("deletedAt", { mode: "date" }), + subAspectId: varchar("subAspectId").references(() => subAspects.id), +}); \ No newline at end of file