Files
outline/server/migrations/20250530235012-create-mentions.js
T
codegen-sh[bot] 94a8326c68 Implement Mention model for tracking user mentions
- Add Mention model with relationships to User and Document
- Create database migration for mentions table
- Add MentionsProcessor to handle document events
- Add comprehensive tests for MentionsProcessor
- Update model relationships in Document and User models

Addresses issue #9268 for tracking user mentions similar to backlinks
2025-05-30 23:53:38 +00:00

56 lines
1.3 KiB
JavaScript

module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.createTable("mentions", {
id: {
type: Sequelize.UUID,
allowNull: false,
primaryKey: true,
},
userId: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "users",
},
},
documentId: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "documents",
},
},
mentionedUserId: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "users",
},
},
mentionType: {
type: Sequelize.STRING,
allowNull: false,
},
mentionId: {
type: Sequelize.STRING,
allowNull: false,
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
},
});
await queryInterface.addIndex("mentions", ["mentionedUserId"]);
await queryInterface.addIndex("mentions", ["documentId"]);
await queryInterface.addIndex("mentions", ["mentionId", "mentionType"]);
},
down: async (queryInterface, Sequelize) => {
await queryInterface.dropTable("mentions");
},
};