Files
outline/server/migrations/20220720221531-remove-deprecated-columns.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

64 lines
2.1 KiB
JavaScript

"use strict";
module.exports = {
async up(queryInterface) {
await queryInterface.sequelize.transaction(async (transaction) => {
// This guard prevents the migration from running and destroying this
// service data if the script from v0.54.0 has not yet been run.
if (process.env.DEPLOYMENT !== "hosted") {
const [teams] = await queryInterface.sequelize.query(
`SELECT COUNT(*) FROM teams`,
{ transaction }
);
const [authenticationProviders] = await queryInterface.sequelize.query(
`SELECT COUNT(*) FROM authentication_providers`,
{ transaction }
);
if (teams[0].count > 0 && authenticationProviders[0].count === 0) {
throw Error(
"Refusing to destroy deprecated columns without authentication providers"
);
}
}
await queryInterface.removeColumn("attachments", "url", { transaction });
await queryInterface.removeColumn("users", "service", { transaction });
await queryInterface.removeColumn("users", "serviceId", { transaction });
await queryInterface.removeColumn("teams", "slackId", { transaction });
await queryInterface.removeColumn("teams", "googleId", { transaction });
});
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.addColumn("attachments", "url", {
type: Sequelize.STRING(4096),
allowNull: false,
defaultValue: "",
transaction,
});
await queryInterface.addColumn("users", "service", {
type: Sequelize.STRING,
allowNull: true,
transaction,
});
await queryInterface.addColumn("users", "serviceId", {
type: Sequelize.STRING,
allowNull: true,
transaction,
});
await queryInterface.addColumn("teams", "slackId", {
type: Sequelize.STRING,
allowNull: true,
transaction,
});
await queryInterface.addColumn("teams", "googleId", {
type: Sequelize.STRING,
allowNull: true,
transaction,
});
});
},
};