Pull Request branch dev-clone to main #1
24
apps/backend/src/drizzle/schema/answerRevisions.ts
Normal file
24
apps/backend/src/drizzle/schema/answerRevisions.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { createId } from "@paralleldrive/cuid2";
|
||||||
|
|
||||||
|
import {
|
||||||
|
boolean,
|
||||||
|
pgTable,
|
||||||
|
text,
|
||||||
|
timestamp,
|
||||||
|
varchar,
|
||||||
|
} from "drizzle-orm/pg-core";
|
||||||
|
import { options } from "./options";
|
||||||
|
import { answers } from "./answers";
|
||||||
|
|
||||||
|
export const answerRevisions = pgTable("answer_revisions", {
|
||||||
|
id: varchar("id", { length: 50 })
|
||||||
|
.primaryKey()
|
||||||
|
.$defaultFn(() => createId()),
|
||||||
|
answerId: varchar("answerId", { length: 50 })
|
||||||
|
.references(() => answers.id),
|
||||||
|
newOptionId: varchar("newOptionId", { length: 50 })
|
||||||
|
.references(() => options.id),
|
||||||
|
revisedBy: varchar("revisedBy").notNull(),
|
||||||
|
newValidationInformation: text("newValidationInformation").notNull(),
|
||||||
|
createdAt: timestamp("createdAt", { mode: "date" }).defaultNow(),
|
||||||
|
});
|
||||||
26
apps/backend/src/drizzle/schema/answers.ts
Normal file
26
apps/backend/src/drizzle/schema/answers.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
import { createId } from "@paralleldrive/cuid2";
|
||||||
|
import { relations } from "drizzle-orm";
|
||||||
|
import {
|
||||||
|
boolean,
|
||||||
|
pgTable,
|
||||||
|
text,
|
||||||
|
timestamp,
|
||||||
|
varchar,
|
||||||
|
} from "drizzle-orm/pg-core";
|
||||||
|
import { options } from "./options";
|
||||||
|
// import { assessments } from "./assessments";
|
||||||
|
|
||||||
|
export const answers = pgTable("answers", {
|
||||||
|
id: varchar("id", { length: 50 })
|
||||||
|
.primaryKey()
|
||||||
|
.$defaultFn(() => createId()),
|
||||||
|
optionId: varchar("optionId", { length: 50 })
|
||||||
|
.references(() => options.id),
|
||||||
|
// assessmentId: varchar("assessmentId", { length: 50 })
|
||||||
|
// .references(() => assessments.id),
|
||||||
|
isFlagged: boolean("isFlagged").default(false),
|
||||||
|
filename: varchar("filename"),
|
||||||
|
validationInformation: text("validationInformation").notNull(),
|
||||||
|
createdAt: timestamp("createdAt", { mode: "date" }).defaultNow(),
|
||||||
|
updatedAt: timestamp("updatedAt", { mode: "date" }).defaultNow(),
|
||||||
|
});
|
||||||
23
apps/backend/src/drizzle/schema/options.ts
Normal file
23
apps/backend/src/drizzle/schema/options.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
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" }),
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user