Files
outline/server/migrations/20250524162119-create-emojis.js
T
codegen-sh[bot] 03de720f6f feat: Add custom emoji backend implementation
- Add Emoji model with team and user associations
- Create migration for emojis table with proper indexes
- Implement API routes: emojis.list, emojis.create, emojis.delete
- Add emoji presenter for consistent API responses
- Implement emoji policies for team-based authorization
- Register emoji routes and exports in main API

Addresses issue #9278
2025-05-24 16:27:03 +00:00

64 lines
1.6 KiB
JavaScript

'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up (queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.createTable("emojis", {
id: {
type: Sequelize.UUID,
primaryKey: true,
allowNull: false
},
name: {
type: Sequelize.STRING,
allowNull: false
},
url: {
type: Sequelize.STRING,
allowNull: false
},
teamId: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "teams",
key: "id"
},
onDelete: "CASCADE"
},
createdById: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: "users",
key: "id"
},
onDelete: "CASCADE"
},
createdAt: {
type: Sequelize.DATE,
allowNull: false
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false
}
}, { transaction });
await queryInterface.addIndex("emojis", ["teamId"], { transaction });
await queryInterface.addIndex("emojis", ["createdById"], { transaction });
await queryInterface.addIndex("emojis", ["teamId", "name"], {
unique: true,
transaction
});
});
},
async down (queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.dropTable("emojis", { transaction });
});
}
};