mirror of
https://github.com/outline/outline.git
synced 2026-06-29 19:24:25 +03:00
c7d339ded5
* Add column and task to calculate size * Store in MB, rather than Bytes * Add cron task to recalculate attachment sizes * findAllInBatches * Index createdAt * fix: Index on incorrect table
22 lines
775 B
JavaScript
22 lines
775 B
JavaScript
"use strict";
|
|
|
|
/** @type {import('sequelize-cli').Migration} */
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
await queryInterface.sequelize.transaction(async transaction => {
|
|
await queryInterface.addColumn("teams", "approximateTotalAttachmentsSize", {
|
|
type: Sequelize.BIGINT,
|
|
defaultValue: 0,
|
|
}, { transaction });
|
|
await queryInterface.addIndex("attachments", ["createdAt"], { transaction });
|
|
});
|
|
},
|
|
|
|
async down(queryInterface, Sequelize) {
|
|
await queryInterface.sequelize.transaction(async transaction => {
|
|
await queryInterface.removeIndex("attachments", ["createdAt"], { transaction });
|
|
await queryInterface.removeColumn("teams", "approximateTotalAttachmentsSize", { transaction });
|
|
});
|
|
},
|
|
};
|