Files
sexy/packages/backend/src/db/schema/comments.ts
Sebastian Krüger efc7624ba3
All checks were successful
Build and Push Backend Image / build (push) Successful in 46s
Build and Push Frontend Image / build (push) Successful in 5m12s
style: apply prettier formatting to all files
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 22:27:54 +01:00

25 lines
850 B
TypeScript

import { pgTable, text, timestamp, index, integer } from "drizzle-orm/pg-core";
import { users } from "./users";
export const comments = pgTable(
"comments",
{
id: integer("id").primaryKey().generatedAlwaysAsIdentity(),
collection: text("collection").notNull(), // 'videos' | 'recordings'
item_id: text("item_id").notNull(),
comment: text("comment").notNull(),
user_id: text("user_id")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
date_created: timestamp("date_created").notNull().defaultNow(),
date_updated: timestamp("date_updated"),
},
(t) => [
index("comments_collection_item_idx").on(t.collection, t.item_id),
index("comments_user_idx").on(t.user_id),
],
);
export type Comment = typeof comments.$inferSelect;
export type NewComment = typeof comments.$inferInsert;