feat(communication): add chat reactions emojis and images
This commit is contained in:
19
backend/db/schema/chat_reactions.ts
Normal file
19
backend/db/schema/chat_reactions.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
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`) }))
|
||||
Reference in New Issue
Block a user