// src/server/features/notes/db/note_comments.table.ts
// Note comments table schema for notes management

import { mysqlTable, varchar, text, timestamp } from 'drizzle-orm/mysql-core';
import { notes } from './notes.table';
import { employees } from '@features/personnel/db/employees.table';

export const noteComments = mysqlTable('note_comments', {
  id: varchar('id', { length: 36 }).primaryKey(),
  noteId: varchar('note_id', { length: 36 })
    .notNull()
    .references(() => notes.id, { onDelete: 'cascade' }),
  authorId: varchar('author_id', { length: 36 })
    .notNull()
    .references(() => employees.id, { onDelete: 'cascade' }),
  content: text('content').notNull(),
  createdAt: timestamp('created_at').notNull().defaultNow(),
  updatedAt: timestamp('updated_at').notNull().defaultNow().onUpdateNow(),
});
