mirror of
https://github.com/outline/outline.git
synced 2026-06-30 19:47:28 +03:00
94a8326c68
- 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
56 lines
1.3 KiB
JavaScript
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");
|
|
},
|
|
};
|
|
|