amati/apps/backend/src/drizzle/schema/options.ts
2024-08-04 21:24:51 +07:00

24 lines
693 B
TypeScript

import { createId } from "@paralleldrive/cuid2";
import { relations } from "drizzle-orm";
import {
integer,
pgTable,
text,
timestamp,
varchar,
} from "drizzle-orm/pg-core";
import { questions } from "./questions";
export const options = pgTable("options", {
id: varchar("id", { length: 50 })
.primaryKey()
.$defaultFn(() => createId()),
questionId: varchar("questionId", { length: 50 })
.references(() => questions.id),
text: text("text").notNull(),
score: integer("score").notNull(),
createdAt: timestamp("createdAt", { mode: "date" }).defaultNow(),
updatedAt: timestamp("updatedAt", { mode: "date" }).defaultNow(),
deletedAt: timestamp("deletedAt", { mode: "date" }),
});