import { sql } from "drizzle-orm" import { bigint, check, pgTable, primaryKey, text, uuid } from "drizzle-orm/pg-core" import { authUsers } from "./auth_users" import { collaborationMessages, collaborationPrincipals } from "./collaboration" import { communicationMessages } from "./communication_messages" export const communicationMessageReactions = pgTable("communication_message_reactions", { messageId: bigint("message_id", { mode: "number" }).notNull().references(() => communicationMessages.id, { onDelete: "cascade" }), actorId: uuid("actor_id").notNull().references(() => authUsers.id, { onDelete: "cascade" }), emoji: text("emoji").notNull(), }, t => ({ pk: primaryKey({ columns: [t.messageId, t.actorId, t.emoji] }), emoji: check("communication_message_reactions_emoji_check", sql`length(${t.emoji}) BETWEEN 1 AND 16`) })) export const collaborationMessageReactions = pgTable("collaboration_message_reactions", { messageId: uuid("message_id").notNull().references(() => collaborationMessages.id, { onDelete: "cascade" }), actorId: uuid("actor_id").notNull().references(() => collaborationPrincipals.id, { onDelete: "cascade" }), emoji: text("emoji").notNull(), }, t => ({ pk: primaryKey({ columns: [t.messageId, t.actorId, t.emoji] }), emoji: check("collaboration_message_reactions_emoji_check", sql`length(${t.emoji}) BETWEEN 1 AND 16`) }))