Files
outline/server/migrations/20241013080608-create-reactions.js
T
codegen-sh[bot] 97f8d0f265 Separate Prettier and ESLint according to best practices (#9565)
* Separate Prettier and ESLint according to best practices

- Create standalone .prettierrc configuration file
- Remove eslint-plugin-prettier integration from ESLint config
- Replace with eslint-config-prettier to disable conflicting rules
- Remove eslint-plugin-prettier dependency
- Add dedicated format and format:check scripts
- Update lint-staged to run Prettier and ESLint separately
- Format entire codebase with new Prettier configuration

This follows the recommended approach from Prettier documentation:
https://prettier.io/docs/integrating-with-linters#notes

* Remove test comment

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
2025-07-08 18:01:48 -04:00

75 lines
1.8 KiB
JavaScript

"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.createTable(
"reactions",
{
id: {
type: Sequelize.UUID,
allowNull: false,
primaryKey: true,
},
emoji: {
type: Sequelize.STRING,
allowNull: false,
},
userId: {
type: Sequelize.UUID,
allowNull: false,
onDelete: "cascade",
references: {
model: "users",
},
},
commentId: {
type: Sequelize.UUID,
allowNull: false,
onDelete: "cascade",
references: {
model: "comments",
},
},
createdAt: {
type: Sequelize.DATE,
allowNull: false,
},
updatedAt: {
type: Sequelize.DATE,
allowNull: false,
},
},
{ transaction }
);
await queryInterface.addIndex("reactions", ["emoji", "userId"], {
transaction,
});
await queryInterface.addIndex("reactions", ["commentId"], {
transaction,
});
await queryInterface.addColumn(
"comments",
"reactions",
{
type: Sequelize.JSONB,
allowNull: true,
},
{ transaction }
);
});
},
async down(queryInterface, Sequelize) {
queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.dropTable("reactions", { transaction });
await queryInterface.removeColumn("comments", "reactions", {
transaction,
});
});
},
};