Files
outline/server/migrations/20240810080954-group-users-remove-deleted-at.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

40 lines
1.1 KiB
JavaScript

"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface) {
await queryInterface.removeColumn("group_users", "deletedAt");
// Cleanup any rows with duplicate groupId + userId
await queryInterface.sequelize.query(`
DELETE FROM group_users
WHERE "createdAt" NOT IN (
SELECT MIN("createdAt")
FROM group_users
GROUP BY "groupId", "userId"
)
`);
// Add groupId + userId as primary key
await queryInterface.addConstraint("group_users", {
fields: ["groupId", "userId"],
type: "primary key",
name: "group_users_pkey",
});
await queryInterface.removeIndex(
"group_users",
"group_users_group_id_user_id"
);
},
async down(queryInterface, Sequelize) {
await queryInterface.addIndex("group_users", ["groupId", "userId"]);
await queryInterface.removeConstraint("group_users", "group_users_pkey");
await queryInterface.addColumn("group_users", "deletedAt", {
type: Sequelize.DATE,
allowNull: true,
});
},
};