Files
outline/server/migrations/20241219023150-group-external-id.js
T
Tom Moor 68a469daa7 Add externalId property on groups (#8127)
* Add 'externalId' property on groups

* Remove clientside Field decorator

* Allow querying by externalId
2024-12-26 08:44:04 -08:00

25 lines
1.0 KiB
JavaScript

"use strict";
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.addColumn("groups", "externalId", {
type: Sequelize.STRING,
}, { transaction });
await queryInterface.addIndex("groups", ["externalId"], { transaction });
await queryInterface.addIndex("group_permissions", ["documentId"], { transaction });
await queryInterface.addIndex("group_permissions", ["sourceId"], { transaction });
});
},
async down(queryInterface, Sequelize) {
await queryInterface.sequelize.transaction(async transaction => {
await queryInterface.removeIndex("group_permissions", ["sourceId"], { transaction });
await queryInterface.removeIndex("group_permissions", ["documentId"], { transaction });
await queryInterface.removeIndex("groups", ["externalId"], { transaction });
await queryInterface.removeColumn("groups", "externalId", { transaction });
});
},
};